cryptoservices/filebasedcertificateandkeystores/test/ttestplugin/cdummykeystoreclient.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2006-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 #ifndef __CDUMMYKEYSTORECLIENT_H__
       
    20 #define __CDUMMYKEYSTORECLIENT_H__
       
    21 
       
    22 #include <mctkeystoremanager.h>
       
    23 
       
    24 /**
       
    25  * Implements the MCTKeyStoreManager interface.
       
    26  *
       
    27  * The class implements the keystore manager token interface for the software
       
    28  * keystore.  It will be created and owned by the unified keystore.
       
    29  */
       
    30 NONSHARABLE_CLASS(CDummyKeyStoreClient) : public MCTKeyStoreManager
       
    31 {
       
    32 public://	One creator function for each token interface
       
    33 	static MCTTokenInterface* NewKeyStoreInterfaceL(MCTToken& aToken);
       
    34 
       
    35 public:
       
    36 	virtual ~CDummyKeyStoreClient();
       
    37 	void AddRef();
       
    38 
       
    39 public:
       
    40 //	*********************************************************************************	
       
    41 //	MKeyStore
       
    42 	virtual void List(RMPointerArray<CCTKeyInfo>& aKeys, const TCTKeyAttributeFilter& aFilter, TRequestStatus& aStatus);
       
    43 	virtual void CancelList();
       
    44 	virtual void GetKeyInfo(TCTTokenObjectHandle aHandle, CCTKeyInfo*& aInfo, TRequestStatus& aStatus);
       
    45 	virtual void CancelGetKeyInfo();
       
    46 	
       
    47 	/** Open an RSA key for signing	*/
       
    48 	virtual void Open(const TCTTokenObjectHandle& aHandle, 
       
    49 					  MRSASigner*& aSigner,
       
    50 					  TRequestStatus& aStatus);
       
    51 	/** Open a DSA key for signing */
       
    52 	virtual void Open(const TCTTokenObjectHandle& aHandle, 
       
    53 					  MDSASigner*& aSigner, 
       
    54 					  TRequestStatus& aStatus);
       
    55 	/** Open a RSA key for private decryption */
       
    56 	virtual void Open(const TCTTokenObjectHandle& aHandle, 
       
    57 					  MCTDecryptor*& aDecryptor,
       
    58 					  TRequestStatus& aStatus);
       
    59 	/** Open a DH key for key agreement */
       
    60 	virtual void Open(const TCTTokenObjectHandle& aHandle, 
       
    61 					  MCTDH*& aDH, TRequestStatus& aStatus);
       
    62 
       
    63 
       
    64 	/// Cancels an ongoing open request
       
    65 	virtual void CancelOpen();
       
    66 	
       
    67 	/** Returns the public key in DER-encoded ASN-1 */
       
    68 	virtual void ExportPublic(const TCTTokenObjectHandle& aHandle,
       
    69 							  HBufC8*& aPublicKey,
       
    70 							  TRequestStatus& aStatus);
       
    71 	virtual void CancelExportPublic();
       
    72 
       
    73 public:
       
    74 //	*********************************************************************************	
       
    75 //	MCTKeyStoreManager
       
    76 	virtual void CreateKey(CCTKeyInfo*& aReturnedKey, TRequestStatus& aStatus);
       
    77 	virtual void CancelCreateKey();
       
    78 	virtual void ImportKey(const TDesC8& aKey, CCTKeyInfo*& aReturnedKey, TRequestStatus& aStatus);
       
    79 	virtual void CancelImportKey();
       
    80 	virtual void ImportEncryptedKey(const TDesC8& aKey, CCTKeyInfo*& aReturnedKey, TRequestStatus& aStatus);
       
    81 	virtual void CancelImportEncryptedKey();
       
    82 	virtual void ExportKey(TCTTokenObjectHandle aHandle, HBufC8*& aKey, TRequestStatus& aStatus); 
       
    83 	virtual void CancelExportKey();
       
    84 	virtual void ExportEncryptedKey(TCTTokenObjectHandle aHandle, const CPBEncryptParms& aParams, HBufC8*& aKey, TRequestStatus& aStatus);
       
    85 	virtual void CancelExportEncryptedKey();
       
    86 	virtual void DeleteKey(TCTTokenObjectHandle aHandle, TRequestStatus& aStatus);
       
    87 	virtual void CancelDeleteKey();	
       
    88 	virtual void SetUsePolicy(TCTTokenObjectHandle aHandle, const TSecurityPolicy& aPolicy, TRequestStatus& aStatus);
       
    89 	virtual void CancelSetUsePolicy();
       
    90 	virtual void SetManagementPolicy(TCTTokenObjectHandle aHandle, const TSecurityPolicy& aPolicy, TRequestStatus& aStatus);
       
    91 	virtual void CancelSetManagementPolicy();
       
    92 	virtual void SetPassphraseTimeout(TInt aTimeout, TRequestStatus& aStatus);
       
    93 	virtual void CancelSetPassphraseTimeout();	
       
    94 	virtual void Relock(TRequestStatus& aStatus);
       
    95 	virtual void CancelRelock();	
       
    96 
       
    97 	void ReleaseObject(const TCTTokenObjectHandle& aObject);
       
    98 
       
    99 public:	
       
   100 //	*********************************************************************************
       
   101 //	From MCTTokenInterface
       
   102 	virtual MCTToken& Token();
       
   103 
       
   104 public:
       
   105 //	*********************************************************************************
       
   106 	void RepudiableDSASign(const TCTTokenObjectHandle& aObject, const TDesC8& aDigest, CDSASignature*& aSignature, TRequestStatus& aStatus);
       
   107 	void RepudiableRSASign(const TCTTokenObjectHandle& aObject, const TDesC8& aDigest, CRSASignature*& aSignature, TRequestStatus& aStatus);
       
   108 	void Decrypt(const TCTTokenObjectHandle& aObject, const TDesC8& aCiphertext, TDes8& aPlaintext, TRequestStatus& aStatus);
       
   109 	void DHPublicKey(const TCTTokenObjectHandle& aHandle, const TInteger& aN, const TInteger& aG, CDHPublicKey*& aX, TRequestStatus& aStatus);
       
   110 	void DHAgree(const TCTTokenObjectHandle& aHandle, const CDHPublicKey& iY, HBufC8*& aAgreedKey, TRequestStatus& aStatus);
       
   111 
       
   112 protected:
       
   113 //	*********************************************************************************
       
   114 //	From MCTTokenInterface
       
   115 	virtual void DoRelease();
       
   116 protected:
       
   117 //	*********************************************************************************
       
   118 	CDummyKeyStoreClient(MCTToken& aToken);
       
   119 	virtual void ConstructL();
       
   120 
       
   121 private:
       
   122 	TInt iRefCount;
       
   123 	
       
   124 private:
       
   125 	MCTToken& iToken;					///< The token we belong to
       
   126 };
       
   127 
       
   128 #endif	//	__CDUMMYKEYSTORECLIENT_H__