os/security/cryptoservices/filebasedcertificateandkeystores/test/ttestplugin/cdummykeystoreclient.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoservices/filebasedcertificateandkeystores/test/ttestplugin/cdummykeystoreclient.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,128 @@
1.4 +/*
1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef __CDUMMYKEYSTORECLIENT_H__
1.23 +#define __CDUMMYKEYSTORECLIENT_H__
1.24 +
1.25 +#include <mctkeystoremanager.h>
1.26 +
1.27 +/**
1.28 + * Implements the MCTKeyStoreManager interface.
1.29 + *
1.30 + * The class implements the keystore manager token interface for the software
1.31 + * keystore. It will be created and owned by the unified keystore.
1.32 + */
1.33 +NONSHARABLE_CLASS(CDummyKeyStoreClient) : public MCTKeyStoreManager
1.34 +{
1.35 +public:// One creator function for each token interface
1.36 + static MCTTokenInterface* NewKeyStoreInterfaceL(MCTToken& aToken);
1.37 +
1.38 +public:
1.39 + virtual ~CDummyKeyStoreClient();
1.40 + void AddRef();
1.41 +
1.42 +public:
1.43 +// *********************************************************************************
1.44 +// MKeyStore
1.45 + virtual void List(RMPointerArray<CCTKeyInfo>& aKeys, const TCTKeyAttributeFilter& aFilter, TRequestStatus& aStatus);
1.46 + virtual void CancelList();
1.47 + virtual void GetKeyInfo(TCTTokenObjectHandle aHandle, CCTKeyInfo*& aInfo, TRequestStatus& aStatus);
1.48 + virtual void CancelGetKeyInfo();
1.49 +
1.50 + /** Open an RSA key for signing */
1.51 + virtual void Open(const TCTTokenObjectHandle& aHandle,
1.52 + MRSASigner*& aSigner,
1.53 + TRequestStatus& aStatus);
1.54 + /** Open a DSA key for signing */
1.55 + virtual void Open(const TCTTokenObjectHandle& aHandle,
1.56 + MDSASigner*& aSigner,
1.57 + TRequestStatus& aStatus);
1.58 + /** Open a RSA key for private decryption */
1.59 + virtual void Open(const TCTTokenObjectHandle& aHandle,
1.60 + MCTDecryptor*& aDecryptor,
1.61 + TRequestStatus& aStatus);
1.62 + /** Open a DH key for key agreement */
1.63 + virtual void Open(const TCTTokenObjectHandle& aHandle,
1.64 + MCTDH*& aDH, TRequestStatus& aStatus);
1.65 +
1.66 +
1.67 + /// Cancels an ongoing open request
1.68 + virtual void CancelOpen();
1.69 +
1.70 + /** Returns the public key in DER-encoded ASN-1 */
1.71 + virtual void ExportPublic(const TCTTokenObjectHandle& aHandle,
1.72 + HBufC8*& aPublicKey,
1.73 + TRequestStatus& aStatus);
1.74 + virtual void CancelExportPublic();
1.75 +
1.76 +public:
1.77 +// *********************************************************************************
1.78 +// MCTKeyStoreManager
1.79 + virtual void CreateKey(CCTKeyInfo*& aReturnedKey, TRequestStatus& aStatus);
1.80 + virtual void CancelCreateKey();
1.81 + virtual void ImportKey(const TDesC8& aKey, CCTKeyInfo*& aReturnedKey, TRequestStatus& aStatus);
1.82 + virtual void CancelImportKey();
1.83 + virtual void ImportEncryptedKey(const TDesC8& aKey, CCTKeyInfo*& aReturnedKey, TRequestStatus& aStatus);
1.84 + virtual void CancelImportEncryptedKey();
1.85 + virtual void ExportKey(TCTTokenObjectHandle aHandle, HBufC8*& aKey, TRequestStatus& aStatus);
1.86 + virtual void CancelExportKey();
1.87 + virtual void ExportEncryptedKey(TCTTokenObjectHandle aHandle, const CPBEncryptParms& aParams, HBufC8*& aKey, TRequestStatus& aStatus);
1.88 + virtual void CancelExportEncryptedKey();
1.89 + virtual void DeleteKey(TCTTokenObjectHandle aHandle, TRequestStatus& aStatus);
1.90 + virtual void CancelDeleteKey();
1.91 + virtual void SetUsePolicy(TCTTokenObjectHandle aHandle, const TSecurityPolicy& aPolicy, TRequestStatus& aStatus);
1.92 + virtual void CancelSetUsePolicy();
1.93 + virtual void SetManagementPolicy(TCTTokenObjectHandle aHandle, const TSecurityPolicy& aPolicy, TRequestStatus& aStatus);
1.94 + virtual void CancelSetManagementPolicy();
1.95 + virtual void SetPassphraseTimeout(TInt aTimeout, TRequestStatus& aStatus);
1.96 + virtual void CancelSetPassphraseTimeout();
1.97 + virtual void Relock(TRequestStatus& aStatus);
1.98 + virtual void CancelRelock();
1.99 +
1.100 + void ReleaseObject(const TCTTokenObjectHandle& aObject);
1.101 +
1.102 +public:
1.103 +// *********************************************************************************
1.104 +// From MCTTokenInterface
1.105 + virtual MCTToken& Token();
1.106 +
1.107 +public:
1.108 +// *********************************************************************************
1.109 + void RepudiableDSASign(const TCTTokenObjectHandle& aObject, const TDesC8& aDigest, CDSASignature*& aSignature, TRequestStatus& aStatus);
1.110 + void RepudiableRSASign(const TCTTokenObjectHandle& aObject, const TDesC8& aDigest, CRSASignature*& aSignature, TRequestStatus& aStatus);
1.111 + void Decrypt(const TCTTokenObjectHandle& aObject, const TDesC8& aCiphertext, TDes8& aPlaintext, TRequestStatus& aStatus);
1.112 + void DHPublicKey(const TCTTokenObjectHandle& aHandle, const TInteger& aN, const TInteger& aG, CDHPublicKey*& aX, TRequestStatus& aStatus);
1.113 + void DHAgree(const TCTTokenObjectHandle& aHandle, const CDHPublicKey& iY, HBufC8*& aAgreedKey, TRequestStatus& aStatus);
1.114 +
1.115 +protected:
1.116 +// *********************************************************************************
1.117 +// From MCTTokenInterface
1.118 + virtual void DoRelease();
1.119 +protected:
1.120 +// *********************************************************************************
1.121 + CDummyKeyStoreClient(MCTToken& aToken);
1.122 + virtual void ConstructL();
1.123 +
1.124 +private:
1.125 + TInt iRefCount;
1.126 +
1.127 +private:
1.128 + MCTToken& iToken; ///< The token we belong to
1.129 +};
1.130 +
1.131 +#endif // __CDUMMYKEYSTORECLIENT_H__