|
1 /* |
|
2 * Copyright (c) 2004 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCMSKeyTransRecipientInfo_H |
|
21 #define CCMSKeyTransRecipientInfo_H |
|
22 |
|
23 #include "CCMSRecipientInfo.h" |
|
24 |
|
25 // FORWARD DECLARATION |
|
26 class CCMSIssuerAndSerialNumber; |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KCMSKeyTransRecipientInfoIssuerAndSerialNumberVersion = 0; |
|
30 const TInt KCMSKeyTransRecipientInfoSubjectKeyIdentifierVersion = 2; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 /** |
|
34 * KeyTransRecipientInfo type module |
|
35 * |
|
36 * ASN.1 definition: |
|
37 * KeyTransRecipientInfo ::= SEQUENCE { |
|
38 * version CMSVersion, -- always set to 0 or 2 |
|
39 * rid RecipientIdentifier, |
|
40 * keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, |
|
41 * encryptedKey EncryptedKey } |
|
42 * |
|
43 * RecipientIdentifier ::= CHOICE { |
|
44 * issuerAndSerialNumber IssuerAndSerialNumber, |
|
45 * subjectKeyIdentifier [0] SubjectKeyIdentifier } |
|
46 * |
|
47 * @lib cms.lib |
|
48 * @since 2.8 |
|
49 */ |
|
50 class CCMSKeyTransRecipientInfo : public CCMSRecipientInfo |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 /** |
|
54 * Two-phased constructor. Leaves the object in cleanup stack. |
|
55 */ |
|
56 IMPORT_C static CCMSKeyTransRecipientInfo* NewLC(); |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 */ |
|
61 IMPORT_C static CCMSKeyTransRecipientInfo* NewL(); |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. Copies of the parameters are made. |
|
65 * |
|
66 * @param aIssuerAndSerialNumber rid (RecipientIdentifier) value |
|
67 * @param aKeyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier |
|
68 * @param aEncryptedKey EncryptedKey value |
|
69 */ |
|
70 IMPORT_C static CCMSKeyTransRecipientInfo* NewL( |
|
71 const CCMSIssuerAndSerialNumber& aIssuerAndSerialNumber, |
|
72 const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm, |
|
73 const TDesC8& aEncryptedKey ); |
|
74 |
|
75 /** |
|
76 * Two-phased constructor. Copies of the parameters are made. |
|
77 * Leaves the object in cleanup stack. |
|
78 * |
|
79 * @param aSubjectKeyIdentifier rid (RecipientIdentifier) value |
|
80 * @param aKeyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier |
|
81 * @param aEncryptedKey EncryptedKey value |
|
82 */ |
|
83 IMPORT_C static CCMSKeyTransRecipientInfo* NewLC( |
|
84 const TDesC8& aSubjectKeyIdentifier, |
|
85 const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm, |
|
86 const TDesC8& aEncryptedKey ); |
|
87 |
|
88 /** |
|
89 * Two-phased constructor. Copies of the parameters are made. |
|
90 * |
|
91 * @param aSubjectKeyIdentifier rid (RecipientIdentifier) value |
|
92 * @param aKeyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier |
|
93 * @param aEncryptedKey EncryptedKey value |
|
94 */ |
|
95 IMPORT_C static CCMSKeyTransRecipientInfo* NewL( |
|
96 const TDesC8& aSubjectKeyIdentifier, |
|
97 const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm, |
|
98 const TDesC8& aEncryptedKey ); |
|
99 |
|
100 |
|
101 /** |
|
102 * Destructor. |
|
103 */ |
|
104 virtual ~CCMSKeyTransRecipientInfo(); |
|
105 |
|
106 public: // New functions |
|
107 /** |
|
108 * Getter for EncryptedKey |
|
109 * @since 2.8 |
|
110 * @return EncryptedKey |
|
111 */ |
|
112 IMPORT_C const TDesC8& EncryptedKey() const; |
|
113 |
|
114 /** |
|
115 * Getter for IssuerAndSerialNumber. Ownership is not transferred. |
|
116 * @since 2,8 |
|
117 * @return IssuerAndSerialNumber or NULL if rid is not |
|
118 * IssuerAndSerialNumber |
|
119 */ |
|
120 IMPORT_C const CCMSIssuerAndSerialNumber* IssuerAndSerialNumber() const; |
|
121 |
|
122 /** |
|
123 * Getter for subjectKeyIdentifier. Ownership is not transferred. |
|
124 * @since 2,8 |
|
125 * @return subjectKeyIdentifier or NULL if rid is not |
|
126 * subjectKeyIdentifier. |
|
127 */ |
|
128 IMPORT_C const TDesC8* SubjectKeyIdentifier() const; |
|
129 |
|
130 /** |
|
131 * Setter for EncryptedKey. Creates a copy of the parameters. |
|
132 * @since 2.8 |
|
133 * @param aEncryptedKey EncryptedKey value. |
|
134 */ |
|
135 IMPORT_C void SetEncryptedKeyL( |
|
136 const TDesC8& aEncryptedKey ); |
|
137 |
|
138 /** |
|
139 * Setter for IssuerAndSerialNumber. Creates a copy of the parameters. |
|
140 * Note that any existing subjectKeyIdentifier value is |
|
141 * deleted. Also version is set to 0. |
|
142 * @since 2.8 |
|
143 * @param aIssuerAndSerialNumber IssuerAndSerialNumber value. |
|
144 */ |
|
145 IMPORT_C void SetIssuerAndSerialNumberL( |
|
146 const CCMSIssuerAndSerialNumber& aIssuerAndSerialNumber ); |
|
147 |
|
148 /** |
|
149 * Setter for subjectKeyIdentifier. Creates a copy of the parameters. |
|
150 * Note that any existing IssuerAndSerialNumber value is |
|
151 * deleted. Also version is set to 2. |
|
152 * @since 2.8 |
|
153 * @param aSubjectKeyIdentifier SubjectKeyIdentifier value. |
|
154 */ |
|
155 IMPORT_C void SetSubjectKeyIdentifierL( |
|
156 const TDesC8& aSubjectKeyIdentifier ); |
|
157 |
|
158 public: // Functions from base classes |
|
159 |
|
160 /** |
|
161 * From MCMSModule |
|
162 * @since 2.8 |
|
163 * @param aRawData raw-data to be parsed in this instance |
|
164 */ |
|
165 void DecodeL( const TDesC8& aRawData ); |
|
166 |
|
167 /** |
|
168 * From MCMSModule |
|
169 * @since 2.8 |
|
170 * @return Returns ASN1 encoder and leaves it in CleanupStack |
|
171 */ |
|
172 CASN1EncBase* EncoderLC() const; |
|
173 |
|
174 /** |
|
175 * From CCMSRecipientInfo |
|
176 * @since 2.8 |
|
177 * @return Returns ASN1 encoder with explicit tag 1 and leaves |
|
178 * it in CleanupStack. |
|
179 */ |
|
180 CASN1EncBase* TaggedEncoderLC() const; |
|
181 |
|
182 protected: // New functions |
|
183 |
|
184 /** |
|
185 * Protected construction to allow derivation |
|
186 */ |
|
187 IMPORT_C void ConstructL( |
|
188 const CCMSIssuerAndSerialNumber& aIssuerAndSerialNumber, |
|
189 const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm, |
|
190 const TDesC8& aEncryptedKey ); |
|
191 |
|
192 /** |
|
193 * Protected construction to allow derivation |
|
194 */ |
|
195 IMPORT_C void ConstructL( |
|
196 const TDesC8& aSubjectKeyIdentifier, |
|
197 const CCMSX509AlgorithmIdentifier& aKeyEncryptionAlgorithm, |
|
198 const TDesC8& aEncryptedKey ); |
|
199 |
|
200 /** |
|
201 * C++ constructor. |
|
202 */ |
|
203 IMPORT_C CCMSKeyTransRecipientInfo( TInt aVersion ); |
|
204 |
|
205 private: // Data |
|
206 // EncryptedKey, owned |
|
207 TDesC8* iEncryptedKey; |
|
208 // IssuerAndSerialNumber, owned |
|
209 CCMSIssuerAndSerialNumber* iIssuerAndSerialNumber; |
|
210 // RecipientEncryptedKey, owned |
|
211 TDesC8* iSubjectKeyIdentifier; |
|
212 |
|
213 }; |
|
214 |
|
215 #endif // CCMSKeyTransRecipientInfo_H |
|
216 |
|
217 // End of File |