Update contrib.
2 * Copyright (c) 2008-2010 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 <cryptospi/cryptosymmetriccipherapi.h>
31 #include "softwarehashbase.h"
32 #include <cryptospi/keys.h>
37 namespace SoftwareCrypto
39 using namespace CryptoSpi;
42 Interfaces for Software Hash
45 NONSHARABLE_CLASS(CMacImpl) : public CBase, public MMac
49 * MAC implementation instance creation methods
51 static CMacImpl* NewL(const CKey& aKey,
52 const TUid aImplementationId,
53 const CCryptoParams* aAlgorithmParams);
56 * Methods from MPlugin: Base class for all the plugins
58 void GetCharacteristicsL(const TCharacteristics*& aPluginCharacteristics);
59 const CExtendedCharacteristics* GetExtendedCharacteristicsL();
60 TAny* GetExtension(TUid aExtensionId);
62 // this deletes the instance of this class. The method is called at the user side
63 // indirectly through the MPlugin pointer instance.
67 * From MMac: MAC interface (Software based)
69 TPtrC8 MacL(const TDesC8& aMessage);
70 void UpdateL(const TDesC8& aMessage);
71 TPtrC8 FinalL(const TDesC8& aMessage);
72 void ReInitialiseAndSetKeyL(const CKey& aKey);
79 * Enumerators to recognize the type of algorithm used for MAC
81 enum TMacBase {EHashBased, ECipherBased};
85 * Constructors and Destructors
89 CMacImpl(const CMacImpl& aMacImpl);
92 * Initialize the 'iHmacImpl' and 'iCipherImpl' instances.
94 void ConstructL(const CKey& aKey, const TUid aImplementationId,const CCryptoParams* aAlgorithmParams);
97 * This will return the Uid of the specific implementation
98 * used for the algorithm.
100 TUid ImplementationUid() const;
103 TUid iImplementationUid;
108 * The hash based MAC implementation. This is software based implementation.
110 CHMacImpl* iHmacImpl;
113 * The symmetric cipher based MAC implementation.
115 CCMacImpl* iCmacImpl;
119 #endif // __CRYPTOAPI_SOFTWAREMACIMPL_H__