os/security/cryptoplugins/cryptospiplugins/source/softwarecrypto/sha2impl.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 /**
    22  @file
    23  @internalComponent
    24  @released
    25 */
    26 
    27 
    28 #ifndef __CRYPTOAPI_SOFTWARESHA2IMPL_H_
    29 #define __CRYPTOAPI_SOFTWARESHA2IMPL_H_
    30 
    31 
    32 #include "softwarehashbase.h"
    33 
    34 namespace SoftwareCrypto
    35 	{
    36 	using namespace CryptoSpi;
    37 	class MSHA2Impl;
    38 	
    39 	NONSHARABLE_CLASS(CSHA2Impl) : public CBase, public MSoftwareHash
    40 		{
    41 	public:
    42 		//NewL & NewLC	
    43 		static CSHA2Impl* NewL(TInt32 aAlgorithmId);
    44 		static CSHA2Impl* NewLC(TInt32 aAlgorithmId);
    45 		
    46 		//From MPlugin
    47 		void Reset();
    48 		void Close();		
    49 		void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);		
    50 		static CExtendedCharacteristics* CreateExtendedCharacteristicsL();
    51 		const CExtendedCharacteristics* GetExtendedCharacteristicsL();
    52 		TAny* GetExtension(TUid aExtensionId);
    53 		
    54 		//From MHash
    55 		TPtrC8 Hash(const TDesC8& aMessage);
    56 		void Update(const TDesC8& aMessage);
    57 		TPtrC8 Final(const TDesC8& aMessage);
    58 		MHash* ReplicateL();		
    59 		MHash* CopyL();
    60 		void SetKeyL(const CKey& aKey);
    61 		void SetOperationModeL(TUid aOperationMode);		
    62 		
    63 		//From MSoftwareHash
    64 		void RestoreState();
    65 		void StoreState();
    66 		
    67 	private:
    68 		//Constructors
    69 		void ConstructL(TInt32 aAlgorithmId);
    70 		void ConstructL(const CSHA2Impl& aSHA512Impl);
    71 		
    72 		//Destructor
    73 		~CSHA2Impl();
    74 		
    75 		TUid ImplementationUid();
    76 
    77 	private:
    78 		MSHA2Impl*	iImplementation;
    79 		const TAny*	iInitValues;
    80 		TUid		iImplementationUid;
    81 		TUint		iHashSize;
    82 		};
    83 	}
    84 
    85 #endif //__CRYPTOAPI_SOFTWARESHA2IMPL_H_