sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@publishedPartner
|
sl@0
|
22 |
@released
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
#ifndef CMSSIGNERIDENTIFIER_H
|
sl@0
|
26 |
#define CMSSIGNERIDENTIFIER_H
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <e32base.h>
|
sl@0
|
29 |
#include <pkcs7issuerserial.h>
|
sl@0
|
30 |
|
sl@0
|
31 |
class CX500DistinguishedName;
|
sl@0
|
32 |
class CX509SubjectKeyIdExt;
|
sl@0
|
33 |
class CASN1EncSequence;
|
sl@0
|
34 |
class CASN1EncBase;
|
sl@0
|
35 |
|
sl@0
|
36 |
|
sl@0
|
37 |
/**
|
sl@0
|
38 |
A representation of a RFC2630 (SignerIdentifier) entity.
|
sl@0
|
39 |
*/
|
sl@0
|
40 |
class CCmsSignerIdentifier : public CBase
|
sl@0
|
41 |
{
|
sl@0
|
42 |
public:
|
sl@0
|
43 |
|
sl@0
|
44 |
/**
|
sl@0
|
45 |
The SignerIdentifier type.
|
sl@0
|
46 |
*/
|
sl@0
|
47 |
enum TSignerIdentifierType
|
sl@0
|
48 |
{
|
sl@0
|
49 |
/** The SignerIdentifier type is issuerAndSerialNumber. */
|
sl@0
|
50 |
EIssuerAndSerialNumber,
|
sl@0
|
51 |
/** The SignerIdentifier type is subjectKeyIdentifier. */
|
sl@0
|
52 |
ESubjectKeyIdentifier
|
sl@0
|
53 |
};
|
sl@0
|
54 |
|
sl@0
|
55 |
/**
|
sl@0
|
56 |
* @internalComponent
|
sl@0
|
57 |
*
|
sl@0
|
58 |
* Creates a CMS SignerIdentifier as defined in RFC2630.
|
sl@0
|
59 |
* @param aIssuerAndSerialNumber An IssuerAndSerialNumber instance used to construct
|
sl@0
|
60 |
* this object. Ownership of aIssuerAndSerialNumber is transferred to the newly
|
sl@0
|
61 |
* created CCmsSignerIdentifier object. If construction fails, ownership is
|
sl@0
|
62 |
* not transferred. The caller needs to push aIssuerAndSerialNumber onto the cleanup stack before calling
|
sl@0
|
63 |
* this method, and pop it off the cleanup stack after successful construction.
|
sl@0
|
64 |
* @return The fully constructed object.
|
sl@0
|
65 |
**/
|
sl@0
|
66 |
static CCmsSignerIdentifier* NewL(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
|
sl@0
|
67 |
|
sl@0
|
68 |
/**
|
sl@0
|
69 |
* @internalComponent
|
sl@0
|
70 |
*
|
sl@0
|
71 |
* Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
|
sl@0
|
72 |
* @param aIssuerAndSerialNumber An IssuerAndSerialNumber instance used to construct
|
sl@0
|
73 |
* this object. Ownership of aIssuerAndSerialNumber is transferred to the newly
|
sl@0
|
74 |
* created CCmsSignerIdentifier object. If construction fails, ownership is
|
sl@0
|
75 |
* not transferred. The caller needs to push aIssuerAndSerialNumber onto the cleanup stack before calling
|
sl@0
|
76 |
* this method, and pop it off the cleanup stack after successful construction.
|
sl@0
|
77 |
* @return The fully constructed object.
|
sl@0
|
78 |
**/
|
sl@0
|
79 |
static CCmsSignerIdentifier* NewLC(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
|
sl@0
|
80 |
|
sl@0
|
81 |
/**
|
sl@0
|
82 |
* @internalComponent
|
sl@0
|
83 |
*
|
sl@0
|
84 |
* Creates a CMS SignerIdentifier as defined in RFC2630.
|
sl@0
|
85 |
* @param aSubjectKeyIdExt A buffer that contains the subject key identifier.
|
sl@0
|
86 |
* Ownership of aSubjectKeyIdExt is transferred to the newly
|
sl@0
|
87 |
* created CCmsSignerIdentifier object. If construction fails, ownership is
|
sl@0
|
88 |
* not transferred. The caller needs to push aSubjectKeyIdExt onto the cleanup stack before calling
|
sl@0
|
89 |
* this method, and pop it off the cleanup stack after successful construction.
|
sl@0
|
90 |
* @return The fully constructed object.
|
sl@0
|
91 |
**/
|
sl@0
|
92 |
static CCmsSignerIdentifier* NewL(HBufC8* aSubjectKeyIdExt);
|
sl@0
|
93 |
|
sl@0
|
94 |
/**
|
sl@0
|
95 |
* @internalComponent
|
sl@0
|
96 |
*
|
sl@0
|
97 |
* Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
|
sl@0
|
98 |
* @param aSubjectKeyIdExt A buffer that contains the subject key identifier.
|
sl@0
|
99 |
* Ownership of aSubjectKeyIdExt is transferred to the newly
|
sl@0
|
100 |
* created CCmsSignerIdentifier object. If construction fails, ownership is
|
sl@0
|
101 |
* not transferred. The caller needs to push aSubjectKeyIdExt onto the cleanup stack before calling
|
sl@0
|
102 |
* this method, and pop it off the cleanup stack after successful construction.
|
sl@0
|
103 |
* @return The fully constructed object
|
sl@0
|
104 |
**/
|
sl@0
|
105 |
static CCmsSignerIdentifier* NewLC(HBufC8* aSubjectKeyIdExt);
|
sl@0
|
106 |
|
sl@0
|
107 |
/**
|
sl@0
|
108 |
* @internalComponent
|
sl@0
|
109 |
*
|
sl@0
|
110 |
* Creates a CMS SignerIdentifier as defined in RFC2630.
|
sl@0
|
111 |
* @param aRawData A buffer that contains the encoded CMS signer identifier.
|
sl@0
|
112 |
* @return The fully constructed object.
|
sl@0
|
113 |
**/
|
sl@0
|
114 |
static CCmsSignerIdentifier* NewL(const TDesC8& aRawData);
|
sl@0
|
115 |
|
sl@0
|
116 |
/**
|
sl@0
|
117 |
* @internalComponent
|
sl@0
|
118 |
*
|
sl@0
|
119 |
* Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
|
sl@0
|
120 |
* @param aRawData A buffer that contains the encoded CMS signer identifier.
|
sl@0
|
121 |
* @return The fully constructed object.
|
sl@0
|
122 |
**/
|
sl@0
|
123 |
static CCmsSignerIdentifier* NewLC(const TDesC8& aRawData);
|
sl@0
|
124 |
|
sl@0
|
125 |
/**
|
sl@0
|
126 |
Destructor
|
sl@0
|
127 |
*/
|
sl@0
|
128 |
IMPORT_C ~CCmsSignerIdentifier();
|
sl@0
|
129 |
|
sl@0
|
130 |
/**
|
sl@0
|
131 |
* @internalComponent
|
sl@0
|
132 |
*
|
sl@0
|
133 |
* Creates the ASN1 sequence of the signer identifier object and leaves it on the cleanup stack.
|
sl@0
|
134 |
* @return ASN1 sequence of this object.
|
sl@0
|
135 |
*/
|
sl@0
|
136 |
CASN1EncBase* EncodeASN1DERLC() const;
|
sl@0
|
137 |
|
sl@0
|
138 |
/**
|
sl@0
|
139 |
Returns the issuer and serial name.
|
sl@0
|
140 |
@return The CPKCS7IssuerAndSerialNumber reference. NULL if the signer
|
sl@0
|
141 |
identifier type is subjectKeyIdentifier. The signer identifier type can be retrieved
|
sl@0
|
142 |
using SignerIdentifierType().
|
sl@0
|
143 |
*/
|
sl@0
|
144 |
IMPORT_C const CPKCS7IssuerAndSerialNumber* IssuerAndSerialNumber() const;
|
sl@0
|
145 |
|
sl@0
|
146 |
/**
|
sl@0
|
147 |
Returns the subject key identifier.
|
sl@0
|
148 |
@return The subject key identifier reference. KNullDesC8 if the signer
|
sl@0
|
149 |
identifier type is issuerAndSerialNumber. The signer identifier type can
|
sl@0
|
150 |
be retrieved using SignerIdentifierType().
|
sl@0
|
151 |
*/
|
sl@0
|
152 |
IMPORT_C const TDesC8& SubjectKeyIdentifier() const;
|
sl@0
|
153 |
|
sl@0
|
154 |
/**
|
sl@0
|
155 |
Returns the type of the signer identifier.
|
sl@0
|
156 |
@return The type of the signer identifier. See the TSignerIdentifierType enum.
|
sl@0
|
157 |
*/
|
sl@0
|
158 |
IMPORT_C TInt SignerIdentifierType() const;
|
sl@0
|
159 |
|
sl@0
|
160 |
protected:
|
sl@0
|
161 |
/**
|
sl@0
|
162 |
* @internalComponent
|
sl@0
|
163 |
*
|
sl@0
|
164 |
* Default constructor
|
sl@0
|
165 |
**/
|
sl@0
|
166 |
CCmsSignerIdentifier();
|
sl@0
|
167 |
|
sl@0
|
168 |
/**
|
sl@0
|
169 |
* @internalComponent
|
sl@0
|
170 |
*
|
sl@0
|
171 |
* Constructor for encoding.
|
sl@0
|
172 |
* @param aIssuerAndSerialNumber The issuer and serial number.
|
sl@0
|
173 |
**/
|
sl@0
|
174 |
CCmsSignerIdentifier(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
|
sl@0
|
175 |
|
sl@0
|
176 |
/**
|
sl@0
|
177 |
* @internalComponent
|
sl@0
|
178 |
*
|
sl@0
|
179 |
* Constructor for encoding
|
sl@0
|
180 |
* @param aSubjectKeyIdExt the subject key identifier extension
|
sl@0
|
181 |
**/
|
sl@0
|
182 |
CCmsSignerIdentifier(HBufC8* aSubjectKeyIdExt);
|
sl@0
|
183 |
|
sl@0
|
184 |
/**
|
sl@0
|
185 |
* @internalComponent
|
sl@0
|
186 |
*
|
sl@0
|
187 |
* Second phase constructor for encoding
|
sl@0
|
188 |
* @param aRawData the raw data
|
sl@0
|
189 |
**/
|
sl@0
|
190 |
void ConstructL(const TDesC8& aRawData);
|
sl@0
|
191 |
|
sl@0
|
192 |
private:
|
sl@0
|
193 |
/**
|
sl@0
|
194 |
The type of the signer identifier.
|
sl@0
|
195 |
*/
|
sl@0
|
196 |
TSignerIdentifierType iSignerIdentifierType;
|
sl@0
|
197 |
|
sl@0
|
198 |
/**
|
sl@0
|
199 |
The issuer and serial number
|
sl@0
|
200 |
*/
|
sl@0
|
201 |
CPKCS7IssuerAndSerialNumber* iIssuerAndSerialNumber;
|
sl@0
|
202 |
|
sl@0
|
203 |
/**
|
sl@0
|
204 |
The subject key identifier.
|
sl@0
|
205 |
*/
|
sl@0
|
206 |
HBufC8* iSubjectKeyIdExt;
|
sl@0
|
207 |
};
|
sl@0
|
208 |
|
sl@0
|
209 |
#endif //CMSSIGNERIDENTIFIER_H
|