|
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: CMS KeyIdentifier type |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CCMSKeyIdentifier_H |
|
21 #define CCMSKeyIdentifier_H |
|
22 |
|
23 #include "CCMSSequence.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 // Extension |
|
27 class MCMSKeyIdentifierExtension; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 /** |
|
31 * This module handles two ASN.1 types, RecipientKeyIdentifier and |
|
32 * KEKIdentifier. |
|
33 * |
|
34 * ASN.1 definitions: |
|
35 * RecipientKeyIdentifier ::= SEQUENCE { |
|
36 * subjectKeyIdentifier SubjectKeyIdentifier, |
|
37 * date GeneralizedTime OPTIONAL, |
|
38 * other OtherKeyAttribute OPTIONAL } |
|
39 * |
|
40 * SubjectKeyIdentifier ::= OCTET STRING |
|
41 * |
|
42 * KEKIdentifier ::= SEQUENCE { |
|
43 * keyIdentifier OCTET STRING, |
|
44 * date GeneralizedTime OPTIONAL, |
|
45 * other OtherKeyAttribute OPTIONAL } |
|
46 * |
|
47 * @lib cms.lib |
|
48 * @since 3.0 |
|
49 */ |
|
50 class CCMSKeyIdentifier : public CCMSSequence |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 */ |
|
56 IMPORT_C static CCMSKeyIdentifier* NewL(); |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. Copies of the parameters are made. |
|
60 * |
|
61 * @param aKeyIdentifier identifies the recipient's |
|
62 * certificate or the the key-encryption key that was |
|
63 * previously distributed to the sender and one or more recipients. |
|
64 */ |
|
65 IMPORT_C static CCMSKeyIdentifier* NewL( |
|
66 const TDesC8& aKeyIdentifier ); |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. Copies of the parameters are made. |
|
70 * |
|
71 * @param aKeyIdentifier identifies the recipient's |
|
72 * certificate or the the key-encryption key that was |
|
73 * previously distributed to the sender and one or more recipients. |
|
74 * @param aDate specifies which of the |
|
75 * recipient's previously distributed UKMs was used by the |
|
76 * sender. In case of KEKIdentifier, specifies a single |
|
77 * key-encryption key from a set. |
|
78 */ |
|
79 IMPORT_C static CCMSKeyIdentifier* NewL( |
|
80 const TDesC8& aKeyIdentifier, |
|
81 const TTime& aDate ); |
|
82 |
|
83 /** |
|
84 * Destructor. |
|
85 */ |
|
86 virtual ~CCMSKeyIdentifier(); |
|
87 |
|
88 public: // New functions |
|
89 /** |
|
90 * Getter for KeyIdentifier |
|
91 * @since 3.0 |
|
92 * @return KeyIdentifier |
|
93 */ |
|
94 IMPORT_C const TDesC8& KeyIdentifier() const; |
|
95 |
|
96 /** |
|
97 * Getter for Date. Ownership is not transferred. |
|
98 * @since 2,8 |
|
99 * @return Date. Ownership is not transferred. |
|
100 */ |
|
101 IMPORT_C const TTime* Date() const; |
|
102 |
|
103 /** |
|
104 * Setter for KeyIdentifier. Creates a copy of the parameters. |
|
105 * @since 3.0 |
|
106 * @param aKeyIdentifier KeyIdentifier value. |
|
107 */ |
|
108 IMPORT_C void SetKeyIdentifierL( |
|
109 const TDesC8& aKeyIdentifier ); |
|
110 |
|
111 /** |
|
112 * Setter for Date. Creates a copy of the parameters. |
|
113 * @since 3.0 |
|
114 * @param aDate Date value |
|
115 */ |
|
116 IMPORT_C void SetDateL( const TTime& aDate ); |
|
117 |
|
118 /** |
|
119 * Decoder method with implicit tag checking. |
|
120 * @since 3.0 |
|
121 * @param aRawData raw-data to be parsed in this instance |
|
122 * @param aImplicitTag tag to be checked |
|
123 */ |
|
124 void DecodeImplicitTagL( const TDesC8& aRawData, |
|
125 const TTagType aImplicitTag ); |
|
126 |
|
127 public: // Functions from base classes |
|
128 |
|
129 /** |
|
130 * From MCMSModule |
|
131 * @since 3.0 |
|
132 * @param aRawData raw-data to be parsed in this instance |
|
133 */ |
|
134 void DecodeL( const TDesC8& aRawData ); |
|
135 |
|
136 /** |
|
137 * From MCMSModule |
|
138 * @since 3.0 |
|
139 * @return Returns ASN1 encoder and leaves it in CleanupStack |
|
140 */ |
|
141 CASN1EncBase* EncoderLC() const; |
|
142 |
|
143 protected: // New functions |
|
144 |
|
145 /** |
|
146 * Protected construction to allow derivation |
|
147 */ |
|
148 IMPORT_C void ConstructL( const TDesC8& aKeyIdentifier ); |
|
149 |
|
150 /** |
|
151 * Protected construction to allow derivation |
|
152 */ |
|
153 IMPORT_C void ConstructL( const TDesC8& aKeyIdentifier, |
|
154 const TTime& aDate ); |
|
155 |
|
156 /** |
|
157 * C++ default constructor. |
|
158 */ |
|
159 IMPORT_C CCMSKeyIdentifier(); |
|
160 |
|
161 private: // New Methods |
|
162 |
|
163 /** |
|
164 * Decodes internal data from a array of ASN.1 decoders |
|
165 * @param aItems items to internalize |
|
166 */ |
|
167 void DecodeArrayL( CArrayPtr< TASN1DecGeneric >* aItems ); |
|
168 |
|
169 private: // Data |
|
170 // KeyIdentifier, owned |
|
171 TDesC8* iKeyIdentifier; |
|
172 // Date, owned |
|
173 TTime* iDate; |
|
174 |
|
175 // Reserved for extensions |
|
176 MCMSKeyIdentifierExtension* iReserved; |
|
177 |
|
178 }; |
|
179 |
|
180 #endif // CCMSKeyIdentifier_H |
|
181 |
|
182 // End of File |