os/security/cryptoservices/filebasedcertificateandkeystores/source/keystore/Client/ClientOpenedKeys.h
First public contribution.
2 * Copyright (c) 2004-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.
24 #ifndef __CLIENTOPENEDKEYS_H__
25 #define __CLIENTOPENEDKEYS_H__
27 class CFSKeyStoreClient;
30 NONSHARABLE_CLASS(COpenedKey) : protected CBase
33 void SetObjectID(TInt aObjectId)
34 {iHandle.iObjectId = aObjectId;}
36 void SetLabel(HBufC* aLabel)
40 * Virtual Release method visible though COpenedKey pointers - the
41 * implementation just calls the Release method from the mixin class in each
44 virtual void Release() = 0;
47 virtual ~COpenedKey();
50 TCTTokenObjectHandle iHandle;
51 CFSKeyStoreClient* iClient;
55 NONSHARABLE_CLASS(CRSARepudiableSigner) : public COpenedKey, public MRSASigner
58 static CRSARepudiableSigner* New(CFSKeyStoreClient* aClient);
60 /** Returns the object's human-readable label */
61 virtual const TDesC& Label() const;
62 /** Returns a reference to the associated token */
63 virtual MCTToken& Token() const;
64 /** Returns a UID representing the type of the token object. The
65 meanings of possible UIDs should be documented in the
66 documentation for the interface that returns them. */
67 virtual TUid Type() const;
68 /** Returns a handle for the object. The primary purpose of the
69 handle is to allow token objects to be 'passed' between
70 processes. See TCTTokenObjectHandle for more details.
72 virtual TCTTokenObjectHandle Handle() const;
75 The data is hashed before the signature is created using the SHA-1
77 @param aPlaintext The string to be signed.
78 @param aSignature The returned signature. This remains owned
79 by the signer, and is valid until the signer is released or
81 @param aStatus Async status notification
83 virtual void SignMessage(const TDesC8& aPlaintext, CRSASignature*& aSignature,
84 TRequestStatus& aStatus);
87 /** Perform a raw signing operation.
89 @param aDigest The data to be signed - this should be some form of hash of
90 the actual message to be signed. If the data is too long, this method will
91 return KErrOverflow through aStatus.
92 @param aSignature The returned signature. This remains owned
93 by the signer, and is valid until the signer is released or
95 @param aStatus Async status notification
97 virtual void Sign(const TDesC8& aData, CRSASignature*& aSignature,
98 TRequestStatus& aStatus);
101 /// Cancel an ongoing sign
102 virtual void CancelSign();
104 virtual void Release();
107 CRSARepudiableSigner(CFSKeyStoreClient* aClient);
108 virtual ~CRSARepudiableSigner();
111 CMessageDigest* iDigest;
115 NONSHARABLE_CLASS(CDSARepudiableSigner) : public COpenedKey, public MDSASigner
118 static CDSARepudiableSigner* New(CFSKeyStoreClient* aClient);
120 /** Returns the object's human-readable label */
121 virtual const TDesC& Label() const;
122 /** Returns a reference to the associated token */
123 virtual MCTToken& Token() const;
124 /** Returns a UID representing the type of the token object. The
125 meanings of possible UIDs should be documented in the
126 documentation for the interface that returns them. */
127 virtual TUid Type() const;
128 /** Returns a handle for the object. The primary purpose of the
129 handle is to allow token objects to be 'passed' between
130 processes. See TCTTokenObjectHandle for more details.
132 virtual TCTTokenObjectHandle Handle() const;
136 @param aPlaintext The string to be signed.
137 @param aSignature The returned signature. This remains owned
138 by the signer, and is valid until the signer is released or
140 @param aStatus Async status notification
142 virtual void SignMessage(const TDesC8& aPlaintext, CDSASignature*& aSignature,
143 TRequestStatus& aStatus);
145 /** Perform a raw signing operation.
147 This method implements a raw sign, without the SHA1 hashing
148 mandated by the DSA specification.
150 @param aPlaintext The string to be signed - this should be some form of
151 hash of the actual message to be signed. If the data is too long, this
152 method will return KErrOverflow through aStatus.
153 @param aSignature The returned signature. This remains owned
154 by the signer, and is valid until the signer is released or
156 @param aStatus Async status notification
158 virtual void Sign(const TDesC8& aData, CDSASignature*& aSignature,
159 TRequestStatus& aStatus);
160 /// Cancel an ongoing sign
161 virtual void CancelSign();
163 virtual void Release();
166 CDSARepudiableSigner(CFSKeyStoreClient* aClient);
167 virtual ~CDSARepudiableSigner();
170 CMessageDigest* iDigest;
173 NONSHARABLE_CLASS(CFSRSADecryptor) : public COpenedKey, public MCTDecryptor
176 static CFSRSADecryptor* New(CFSKeyStoreClient* aClient);
178 /** Returns the object's human-readable label */
179 virtual const TDesC& Label() const;
180 /** Returns a reference to the associated token */
181 virtual MCTToken& Token() const;
182 /** Returns a UID representing the type of the token object. The
183 meanings of possible UIDs should be documented in the
184 documentation for the interface that returns them. */
185 virtual TUid Type() const;
186 /** Returns a handle for the object. The primary purpose of the
187 handle is to allow token objects to be 'passed' between
188 processes. See TCTTokenObjectHandle for more details.
190 virtual TCTTokenObjectHandle Handle() const;
192 /** Do a private decrypt.
193 @param aCiphertext The text to decrypt
194 @param aPlaintext The returned plaintext
195 @param aStatus Async status notification
197 virtual void Decrypt(const TDesC8& aCiphertext, TDes8& aPlaintext,
198 TRequestStatus& aStatus);
199 /// Cancel an ongoing decrypt
200 virtual void CancelDecrypt();
201 virtual void Release();
204 CFSRSADecryptor(CFSKeyStoreClient* aClient);
205 virtual ~CFSRSADecryptor();
208 NONSHARABLE_CLASS(CDHAgreement) : public COpenedKey, public MCTDH
211 static CDHAgreement* New(CFSKeyStoreClient* aClient);
213 /** Returns the object's human-readable label */
214 virtual const TDesC& Label() const;
215 /** Returns a reference to the associated token */
216 virtual MCTToken& Token() const;
217 /** Returns a UID representing the type of the token object. The
218 meanings of possible UIDs should be documented in the
219 documentation for the interface that returns them. */
220 virtual TUid Type() const;
221 /** Returns a handle for the object. The primary purpose of the
222 handle is to allow token objects to be 'passed' between
223 processes. See TCTTokenObjectHandle for more details.
225 virtual TCTTokenObjectHandle Handle() const;
227 /** Returns the public key ('Big X') for the supplied set of parameters */
228 virtual void PublicKey(const TInteger& aN, const TInteger& aG,
230 TRequestStatus& aStatus);
231 /** Agrees a session key given the public key of the other party */
232 virtual void Agree(const CDHPublicKey& iY,
234 TRequestStatus& aStatus);
235 /** Cancels either a PublicKey or Agree operation */
236 virtual void CancelAgreement();
237 virtual void Release();
240 CDHAgreement(CFSKeyStoreClient* aClient);
241 virtual ~CDHAgreement();