|
1 /* |
|
2 * Copyright (c) 2008 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 "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: Provide the functionality of a RSA digital signature algorithm |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef STSRSASIGNATURE_H |
|
20 #define STSRSASIGNATURE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <string> |
|
24 |
|
25 #include <openssl/rsa.h> |
|
26 #include <openssl/pem.h> |
|
27 #include <openssl/x509.h> |
|
28 #include <openssl/evp.h> |
|
29 #include <jni.h> |
|
30 #include "stssignature.h" |
|
31 |
|
32 using namespace std; |
|
33 |
|
34 // CONSTANTS |
|
35 |
|
36 // CLASS DECLARATION |
|
37 class CRSAPublicKey; |
|
38 class CX509SubjectPublicKeyInfo; |
|
39 class CAlgorithmIdentifier; |
|
40 |
|
41 namespace java |
|
42 { |
|
43 namespace satsa |
|
44 { |
|
45 /** |
|
46 * Provides RSA signature algorithm. |
|
47 * |
|
48 */ |
|
49 class STSRSASignature: public STSSignature |
|
50 { |
|
51 public: |
|
52 |
|
53 static STSRSASignature* Create(const std::wstring aPadding, int* errCode); |
|
54 |
|
55 virtual ~STSRSASignature(); |
|
56 |
|
57 public: |
|
58 // From STSSignature |
|
59 |
|
60 int InitVerify(JNIEnv* aJni, jstring aKeyAlgorithm, jstring aKeyFormat, |
|
61 jbyteArray aKeyEncoded); |
|
62 |
|
63 int Verify(JNIEnv* aJni, jbyteArray aSignature); |
|
64 |
|
65 int Update(JNIEnv* aJni, jbyteArray aData, jint aOffset, jint aLength); |
|
66 |
|
67 protected: |
|
68 |
|
69 STSRSASignature(); |
|
70 |
|
71 int Construct(const std::wstring aPadding); |
|
72 |
|
73 private: |
|
74 CRSAPublicKey* mRSAKey; |
|
75 CAlgorithmIdentifier* mHashID; |
|
76 RSA *mRSA; |
|
77 EVP_PKEY *mpkey; |
|
78 }; |
|
79 } // namespace satsa |
|
80 } // namespace java |
|
81 #endif // STSRSASIGNATURE_H |
|
82 // End of File |