First public contribution.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
26 #ifndef __CRYPTOAPI_SOFTWAREHMACIMPL_H__
27 #define __CRYPTOAPI_SOFTWAREHMACIMPL_H__
29 #include "softwarehashbase.h"
32 namespace SoftwareCrypto
34 using namespace CryptoSpi;
37 * This is the maximum block size currently supported by HMAC implementation.
39 const TInt KMaxBlockSize = 128;
41 NONSHARABLE_CLASS(CHMacImpl) : public CBase, public MSoftwareHash
45 static CHMacImpl* NewL(MSoftwareHash* aHash);
46 static CHMacImpl* NewLC(MSoftwareHash* aHash);
47 static CHMacImpl* NewL(const CKey& aKey, MSoftwareHash* aHash);
48 static CHMacImpl* NewLC(const CKey& aKey, MSoftwareHash* aHash);
53 void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
54 const CExtendedCharacteristics* GetExtendedCharacteristicsL();
55 TAny* GetExtension(TUid aExtensionId);
58 TPtrC8 Hash(const TDesC8& aMessage);
59 void Update(const TDesC8& aMessage);
60 TPtrC8 Final(const TDesC8& aMessage);
61 void SetKeyL(const CKey& aKey);
62 void SetOperationModeL(TUid aOperationMode);
69 CHMacImpl(const CHMacImpl& aHMacImpl);
75 void ConstructL(const CKey& aKey, MSoftwareHash* aHash);
76 void ConstructL(MSoftwareHash* aHash);
77 void Initialise(const TDesC8& aKey);
78 void InitBlockSizeL();
81 TUid iImplementationUid;
82 MSoftwareHash* iDigest;
84 TBuf8<KMaxBlockSize> iInnerPad;
85 TBuf8<KMaxBlockSize> iOuterPad;
86 TBuf8<KMaxBlockSize> iInnerPadCopy;
87 TBuf8<KMaxBlockSize> iOuterPadCopy;
93 #endif // __CRYPTOAPI_SOFTWAREHMACIMPL_H__