|
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 * Signer Abstract interface |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @publishedPartner |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef __CRYPTOAPI_SIGNER_H__ |
|
27 #define __CRYPTOAPI_SIGNER_H__ |
|
28 |
|
29 #include <cryptospi/cryptoplugin.h> |
|
30 #include "keys.h" |
|
31 |
|
32 namespace CryptoSpi |
|
33 { |
|
34 /** |
|
35 The Signer definition. Intended to allow plug-ins to implement |
|
36 extensible signature signer functionality, and to work with all |
|
37 known existing signature algorithms, e.g. DSA, RSA etc |
|
38 */ |
|
39 class MSignatureBase : public MPlugin |
|
40 { |
|
41 public: |
|
42 /** |
|
43 Set the padding mode for the signer or verifier. Reset() is called to reinitialise the cipher. |
|
44 @param aPaddingMode The padding mode of the signer |
|
45 */ |
|
46 virtual void SetPaddingModeL(TUid aPaddingMode) = 0; |
|
47 |
|
48 /** |
|
49 Set the private key for the signer or verifier. Reset() is called to reinitialise the cipher. |
|
50 @param aPrivateKey The privatekey that used to sign |
|
51 */ |
|
52 virtual void SetKeyL(const CKey& aPrivateKey) = 0; |
|
53 |
|
54 /** |
|
55 Gets the maximum size of input accepted by this object. |
|
56 @return The maximum length allowed in bytes |
|
57 */ |
|
58 virtual TInt GetMaximumInputLengthL() const = 0; |
|
59 |
|
60 /** |
|
61 Gets the maximum size of output that can be generated by this object. |
|
62 @return The maximum output length in bytes |
|
63 */ |
|
64 virtual TInt GetMaximumOutputLengthL() const = 0; |
|
65 }; |
|
66 |
|
67 class MSigner : public MSignatureBase |
|
68 { |
|
69 public: |
|
70 |
|
71 /** |
|
72 Signs the input hash |
|
73 @param aInput The hash of the message to sign |
|
74 @param aSignature The signature of the hash |
|
75 */ |
|
76 virtual void SignL(const TDesC8& aInput, CCryptoParams& aSignature) = 0; |
|
77 }; |
|
78 |
|
79 |
|
80 class MAsyncSigner : public MSignatureBase |
|
81 { |
|
82 public: |
|
83 |
|
84 /** |
|
85 Set the public key for the signer |
|
86 @param aInput The hash of the message to sign |
|
87 @param aSignature The signature of the hash |
|
88 @param aRequestStatus |
|
89 */ |
|
90 virtual void SignL(const TDesC8& aInput, CCryptoParams& aSignature, TRequestStatus& aRequestStatus) = 0; |
|
91 |
|
92 /** |
|
93 Cancel the outstanding request |
|
94 */ |
|
95 virtual void Cancel() = 0; |
|
96 |
|
97 }; |
|
98 |
|
99 } // namespace CryptoSpi |
|
100 |
|
101 #endif //__CRYPTOAPI_SIGNER_H__ |