cryptoplugins/cryptospiplugins/source/softwarecrypto/randomimpl.h
author Santosh V Patil <santosh.v.patil@nokia.com>
Mon, 28 Jun 2010 09:21:13 +0530
branchRCL_3
changeset 54 0d3a50e36d4b
parent 41 9b5a3a9fddf8
permissions -rw-r--r--
Transplanting changeset f3b0b5725c58 (Fix for bug 1301)

/*
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
* Software random implementation
*
*/


/**
 @file
 @internalComponent
 @released
*/

#ifndef __CRYPTOAPI_RANDOMIMPL_H__
#define __CRYPTOAPI_RANDOMIMPL_H__

#include <cryptospi/cryptoplugin.h>
#include <cryptospi/randomplugin.h>

namespace SoftwareCrypto
	{
	using namespace CryptoSpi;
	
	NONSHARABLE_CLASS(CRandomImpl): public CBase, public MRandom
		{
	public:
		// NewL & NewLC
		static CRandomImpl* NewL();
		static CRandomImpl* NewLC();
		
		// From MPlugin
		void Reset();
		void Close();
		void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
		const CExtendedCharacteristics* GetExtendedCharacteristicsL();
		TAny* GetExtension(TUid aExtensionId);
		TUid ImplementationUid() const;
		
		// From MRandom
		void GenerateRandomBytesL(TDes8& aDest);
		
		static CExtendedCharacteristics* CreateExtendedCharacteristicsL();
		
	private:
		//Constructor
		CRandomImpl();
		
		//Destructor
		~CRandomImpl();
		
	private:
		TUid iImplementationUid;
		};
	}

#endif // __CRYPTOAPI_RANDOMIMPL_H__