|
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 __RSASIGNERIMPL_H__ |
|
20 #define __RSASIGNERIMPL_H__ |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalComponent |
|
25 @released |
|
26 */ |
|
27 |
|
28 #include <e32base.h> |
|
29 #include <e32cmn.h> |
|
30 #include <cryptospi/cryptospidef.h> |
|
31 |
|
32 #include "signerimpl.h" |
|
33 #include "../../../source/common/inlines.h" |
|
34 |
|
35 /** |
|
36 * Implementation of RSA signing |
|
37 */ |
|
38 namespace SoftwareCrypto |
|
39 { |
|
40 using namespace CryptoSpi; |
|
41 |
|
42 NONSHARABLE_CLASS(CRSASignerImpl) : public CSignerImpl |
|
43 { |
|
44 public: |
|
45 /** |
|
46 Creates an instance of an RSA signer plug-in. |
|
47 @param aKey The private key used to sign. |
|
48 @param aPaddingMode The padding mode |
|
49 @return A pointer to a CRSASignerImpl instance |
|
50 */ |
|
51 static CRSASignerImpl* NewL(TUid aImplementationUid, const CKey& aKey, TUid aPaddingMode); |
|
52 |
|
53 /** |
|
54 Creates an instance of an RSA signer plug-in. |
|
55 @param aKey The private key used to sign. |
|
56 @param aPaddingMode The padding mode |
|
57 @return A pointer to a CRSASignerImpl instance |
|
58 */ |
|
59 static CRSASignerImpl* NewLC(TUid aImplementationUid, const CKey& aKey, TUid aPaddingMode); |
|
60 |
|
61 // Override CSignerImpl virtual functions |
|
62 TUid ImplementationUid() const; |
|
63 // End of CSignerImpl |
|
64 |
|
65 // Override MSignatureBase virtual functions |
|
66 void SetKeyL(const CKey& aPrivateKey); |
|
67 void SetPaddingModeL(TUid aPaddingMode); |
|
68 TInt GetMaximumInputLengthL() const; |
|
69 TInt GetMaximumOutputLengthL() const; |
|
70 // End of MSignatureBase |
|
71 |
|
72 // Override MSigner virtual functions |
|
73 void SignL(const TDesC8& aInput, CCryptoParams& aSignature); |
|
74 // End of MSigner |
|
75 |
|
76 const CExtendedCharacteristics* GetExtendedCharacteristicsL(); |
|
77 static CExtendedCharacteristics* CreateExtendedCharacteristicsL(); |
|
78 |
|
79 /// Destructor |
|
80 ~CRSASignerImpl(); |
|
81 |
|
82 protected: |
|
83 /// Constructor |
|
84 CRSASignerImpl(TUid aImplementationUid, TUid aPaddingMode); |
|
85 |
|
86 /// second phase of construction |
|
87 virtual void ConstructL(const CKey& aKey); |
|
88 |
|
89 protected: |
|
90 /// the current padding scheme |
|
91 TUid iPaddingMode; |
|
92 CPadding* iPadding; |
|
93 |
|
94 private: |
|
95 |
|
96 TUid iImplementationUid; |
|
97 }; |
|
98 } |
|
99 |
|
100 #endif // __RSASIGNERIMPL_H__ |