First public contribution.
2 * Copyright (c) 2008-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.
15 * mac plugin implementation
26 #ifndef __CRYPTOAPI_SOFTWAREMACIMPL_H__
27 #define __CRYPTOAPI_SOFTWAREMACIMPL_H__
29 #include <cryptospi/macplugin.h>
30 #include "cryptosymmetriccipherapi.h"
31 #include "softwarehashbase.h"
37 namespace SoftwareCrypto
39 using namespace CryptoSpi;
41 NONSHARABLE_CLASS(CMacImpl) : public CBase, public MMac
45 * MAC implementation instance creation methods
47 static CMacImpl* NewL(const CKey& aKey,
48 const TUid aImplementationId,
49 const CCryptoParams* aAlgorithmParams);
52 * Methods from MPlugin: Base class for all the plugins
54 void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
55 const CExtendedCharacteristics* GetExtendedCharacteristicsL();
56 TAny* GetExtension(TUid aExtensionId);
58 // this deletes the instance of this class. The method is called at the user side
59 // indirectly through the MPlugin pointer instance.
63 * From MMac: MAC interface (Software based)
65 TPtrC8 MacL(const TDesC8& aMessage);
66 void UpdateL(const TDesC8& aMessage);
67 TPtrC8 FinalL(const TDesC8& aMessage);
68 void ReInitialiseAndSetKeyL(const CKey& aKey);
75 * Enumerators to recognize the type of algorithm used for MAC
77 enum TMacBase {EHashBased, ECipherBased};
81 * Constructors and Destructors
85 CMacImpl(const CMacImpl& aMacImpl);
88 * Initialize the 'iHmacImpl' and 'iCipherImpl' instances.
90 void ConstructL(const CKey& aKey, const TUid aImplementationId,const CCryptoParams* aAlgorithmParams);
93 * This will return the Uid of the specific implementation
94 * used for the algorithm.
96 TUid ImplementationUid() const;
99 TUid iImplementationUid;
104 * The hash based MAC implementation. This is software based implementation.
106 CHMacImpl* iHmacImpl;
109 * The symmetric cipher based MAC implementation.
111 CCMacImpl* iCmacImpl;
115 #endif // __CRYPTOAPI_SOFTWAREMACIMPL_H__