First public contribution.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
25 #ifndef CMSSIGNERIDENTIFIER_H
26 #define CMSSIGNERIDENTIFIER_H
29 #include <pkcs7issuerserial.h>
31 class CX500DistinguishedName;
32 class CX509SubjectKeyIdExt;
33 class CASN1EncSequence;
38 A representation of a RFC2630 (SignerIdentifier) entity.
40 class CCmsSignerIdentifier : public CBase
45 The SignerIdentifier type.
47 enum TSignerIdentifierType
49 /** The SignerIdentifier type is issuerAndSerialNumber. */
50 EIssuerAndSerialNumber,
51 /** The SignerIdentifier type is subjectKeyIdentifier. */
58 * Creates a CMS SignerIdentifier as defined in RFC2630.
59 * @param aIssuerAndSerialNumber An IssuerAndSerialNumber instance used to construct
60 * this object. Ownership of aIssuerAndSerialNumber is transferred to the newly
61 * created CCmsSignerIdentifier object. If construction fails, ownership is
62 * not transferred. The caller needs to push aIssuerAndSerialNumber onto the cleanup stack before calling
63 * this method, and pop it off the cleanup stack after successful construction.
64 * @return The fully constructed object.
66 static CCmsSignerIdentifier* NewL(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
71 * Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
72 * @param aIssuerAndSerialNumber An IssuerAndSerialNumber instance used to construct
73 * this object. Ownership of aIssuerAndSerialNumber is transferred to the newly
74 * created CCmsSignerIdentifier object. If construction fails, ownership is
75 * not transferred. The caller needs to push aIssuerAndSerialNumber onto the cleanup stack before calling
76 * this method, and pop it off the cleanup stack after successful construction.
77 * @return The fully constructed object.
79 static CCmsSignerIdentifier* NewLC(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
84 * Creates a CMS SignerIdentifier as defined in RFC2630.
85 * @param aSubjectKeyIdExt A buffer that contains the subject key identifier.
86 * Ownership of aSubjectKeyIdExt is transferred to the newly
87 * created CCmsSignerIdentifier object. If construction fails, ownership is
88 * not transferred. The caller needs to push aSubjectKeyIdExt onto the cleanup stack before calling
89 * this method, and pop it off the cleanup stack after successful construction.
90 * @return The fully constructed object.
92 static CCmsSignerIdentifier* NewL(HBufC8* aSubjectKeyIdExt);
97 * Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
98 * @param aSubjectKeyIdExt A buffer that contains the subject key identifier.
99 * Ownership of aSubjectKeyIdExt is transferred to the newly
100 * created CCmsSignerIdentifier object. If construction fails, ownership is
101 * not transferred. The caller needs to push aSubjectKeyIdExt onto the cleanup stack before calling
102 * this method, and pop it off the cleanup stack after successful construction.
103 * @return The fully constructed object
105 static CCmsSignerIdentifier* NewLC(HBufC8* aSubjectKeyIdExt);
110 * Creates a CMS SignerIdentifier as defined in RFC2630.
111 * @param aRawData A buffer that contains the encoded CMS signer identifier.
112 * @return The fully constructed object.
114 static CCmsSignerIdentifier* NewL(const TDesC8& aRawData);
119 * Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
120 * @param aRawData A buffer that contains the encoded CMS signer identifier.
121 * @return The fully constructed object.
123 static CCmsSignerIdentifier* NewLC(const TDesC8& aRawData);
128 IMPORT_C ~CCmsSignerIdentifier();
133 * Creates the ASN1 sequence of the signer identifier object and leaves it on the cleanup stack.
134 * @return ASN1 sequence of this object.
136 CASN1EncBase* EncodeASN1DERLC() const;
139 Returns the issuer and serial name.
140 @return The CPKCS7IssuerAndSerialNumber reference. NULL if the signer
141 identifier type is subjectKeyIdentifier. The signer identifier type can be retrieved
142 using SignerIdentifierType().
144 IMPORT_C const CPKCS7IssuerAndSerialNumber* IssuerAndSerialNumber() const;
147 Returns the subject key identifier.
148 @return The subject key identifier reference. KNullDesC8 if the signer
149 identifier type is issuerAndSerialNumber. The signer identifier type can
150 be retrieved using SignerIdentifierType().
152 IMPORT_C const TDesC8& SubjectKeyIdentifier() const;
155 Returns the type of the signer identifier.
156 @return The type of the signer identifier. See the TSignerIdentifierType enum.
158 IMPORT_C TInt SignerIdentifierType() const;
164 * Default constructor
166 CCmsSignerIdentifier();
171 * Constructor for encoding.
172 * @param aIssuerAndSerialNumber The issuer and serial number.
174 CCmsSignerIdentifier(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
179 * Constructor for encoding
180 * @param aSubjectKeyIdExt the subject key identifier extension
182 CCmsSignerIdentifier(HBufC8* aSubjectKeyIdExt);
187 * Second phase constructor for encoding
188 * @param aRawData the raw data
190 void ConstructL(const TDesC8& aRawData);
194 The type of the signer identifier.
196 TSignerIdentifierType iSignerIdentifierType;
199 The issuer and serial number
201 CPKCS7IssuerAndSerialNumber* iIssuerAndSerialNumber;
204 The subject key identifier.
206 HBufC8* iSubjectKeyIdExt;
209 #endif //CMSSIGNERIDENTIFIER_H