Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
2 * Copyright (c) 1998-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.
15 * X509 certificate implementation
27 #ifndef __X509CERT_H__
28 #define __X509CERT_H__
37 _LIT(KMD2WithRSA,"1.2.840.113549.1.1.2");
38 _LIT(KMD5WithRSA,"1.2.840.113549.1.1.4");
39 _LIT(KSHA1WithRSA,"1.2.840.113549.1.1.5");
40 _LIT(KDSAWithSHA1,"1.2.840.10040.4.3");
42 _LIT(KRSA,"1.2.840.113549.1.1.1");
43 _LIT(KDH,"1.2.840.10046.2.1");
44 _LIT(KDSA,"1.2.840.10040.4.1");
45 _LIT(KMD5,"1.2.840.113549.2.5");
46 _LIT(KMD2,"1.2.840.113549.2.2");
47 _LIT(KSHA1,"1.3.14.3.2.26");
49 /** The maximum number of allowed data elements.
52 const TInt KX509MaxDataElements = 10;
59 class CPKCS1SignatureResult : public CRSASignatureResult
60 /** The signature result in PKCS#1 format.
67 /** Creates a new algorithm ID object copied from an existing object.
69 * @param aDigestAlgorithm The algorithm ID object to be copied.
70 * @param aDigest A non-modifiable descriptor representing the digest algorithm.
71 * @return A pointer to the new algorithm ID object. */
72 IMPORT_C static CPKCS1SignatureResult* NewL(const CAlgorithmIdentifier& aDigestAlgorithm, const TDesC8& aDigest);
74 /** Creates a new algorithm ID object copied from an existing
75 * object, and puts a pointer to the new object onto the cleanup stack.
77 * @param aDigestAlgorithm The algorithm ID object to be copied.
78 * @param aDigest A non-modifiable descriptor representing the digest algorithm.
79 * @return A pointer to the new algorithm ID object. */
80 IMPORT_C static CPKCS1SignatureResult* NewLC(const CAlgorithmIdentifier& aDigestAlgorithm, const TDesC8& aDigest);
82 /** Tests whether the signature result is valid.
84 * @param aResult The signature result to be verified.
85 * @return ETrue, if the signature result is verified; EFalse, otherwise. */
86 IMPORT_C virtual TBool VerifyL(const TDesC8& aResult);
88 void ConstructL(const CAlgorithmIdentifier& aDigestAlgorithm, const TDesC8& aDigest);
89 TBool DoVerifyL(const TDesC8& aResult);
92 class TX509KeyFactory : public TKeyFactory
93 /** Constructs the public key objects used for signature verification, from their
94 * encoded binary form, for X.509 certificates.
101 /** Gets the RSA public key from the encoding key.
103 * @param aEncoding A non-modifiable descriptor representing the entire encoding.
104 * @return The RSA Public key. */
105 IMPORT_C CRSAPublicKey* RSAPublicKeyL(const TDesC8& aEncoding) const;
107 /** Gets the RSA signature result.
109 * @param aDigestAlgorithm The digest algorithm ID.
110 * @param aDigest A non-modifiable descriptor representing the digest algorithm.
111 * @return The RSA signature result. */
112 IMPORT_C CRSASignatureResult* RSASignatureResultL(const CAlgorithmIdentifier& aDigestAlgorithm, TDesC8& aDigest) const;
114 /** Gets the DSA public key from the encoding key.
116 * @param aParamsEncoding A non-modifiable descriptor representing
117 * the encoded binary representation of the DSA parameters
118 * @param aEncoding A non-modifiable descriptor representing the entire encoding.
119 * @return The DSA public key.
121 IMPORT_C CDSAPublicKey* DSAPublicKeyL(const TDesC8& aParamsEncoding, const TDesC8& aEncoding) const;
123 /** Gets the digital DSA signature from the encoding key.
125 * @param aEncoding A non-modifiable descriptor representing the entire encoding.
126 * @return The DSA signature. */
127 IMPORT_C CDSASignature* DSASignatureL(const TDesC8& aEncoding) const;
129 /** Gets the DSA parameters from the encoding key.
131 * @param aEncoding A non-modifiable descriptor representing the entire encoding.
132 * @return The DSA parameters. */
133 IMPORT_C CDSAParameters* DSAParametersL(const TDesC8& aEncoding) const;
135 /** Gets the DSA public key from the encoding key.
137 * @param aParams The DSA parameters
138 * @param aEncoding A non-modifiable descriptor representing the entire encoding.
139 * @return The DSA public key. */
140 IMPORT_C CDSAPublicKey* DSAPublicKeyL(const CDSAParameters& aParams, const TDesC8& aEncoding) const;
143 class CX509ValidityPeriod : public CValidityPeriod
144 /** The period for which an X.509 certificate is valid.
151 /** Creates a new X.509 validity period object from the specified buffer containing
152 * the binary coded representation.
154 * Initialises the object from its encoded binary form into an internal representation.
156 * @param aBinaryData The encoded binary representation.
157 * @return The new validity period object. */
158 IMPORT_C static CX509ValidityPeriod* NewL(const TDesC8& aBinaryData);
160 /** Creates a new X.509 validity period object from the specified buffer containing
161 * the binary coded representation, and puts a pointer to it onto the cleanup stack.
163 * Initialises the object from its encoded binary form into an internal representation.
165 * @param aBinaryData The encoded binary representation.
166 * @return The new validity period object. */
167 IMPORT_C static CX509ValidityPeriod* NewLC(const TDesC8& aBinaryData);
169 /** Creates a new X.509 validity period object from the specified buffer containing
170 * the binary coded representation, starting at the specified offset.
172 * Initialises the object from its encoded binary form into an internal representation.
174 * @param aBinaryData The encoded binary representation.
175 * @param aPos The offset position from which to start decoding.
176 * @return The new validity period object. */
177 IMPORT_C static CX509ValidityPeriod* NewL(const TDesC8& aBinaryData, TInt& aPos);
179 /** Creates a new X.509 validity period object from the specified buffer containing
180 * the binary coded representation, starting at the specified offset, and puts
181 * a pointer to it onto the cleanup stack.
183 * Initialises the object from its encoded binary form into an internal representation.
185 * @param aBinaryData The encoded binary representation.
186 * @param aPos The offset position from which to start decoding.
187 * @return The new validity period object. */
188 IMPORT_C static CX509ValidityPeriod* NewLC(const TDesC8& aBinaryData, TInt& aPos);
190 CX509ValidityPeriod();
191 void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
194 class CX509AlgorithmIdentifier : public CAlgorithmIdentifier
195 /** Algorithm identifier for an X.509 certificate.
202 /** Creates a new X.509 algorithm identifier object from the specified buffer containing
203 * the binary coded representation.
205 * The function initialises the object from its encoded binary form into an internal
208 * @param aBinaryData The encoded binary representation.
209 * @return The new algorithm identifier object. */
210 IMPORT_C static CX509AlgorithmIdentifier* NewL(const TDesC8& aBinaryData);
212 /** Creates a new X.509 algorithm identifier object from the specified buffer containing
213 * the binary coded representation, and puts a pointer to it onto the cleanup stack.
215 * @param aBinaryData The encoded binary representation.
216 * @return The new algorithm identifier object. */
217 IMPORT_C static CX509AlgorithmIdentifier* NewLC(const TDesC8& aBinaryData);
219 /** Creates a new X.509 algorithm identifier object from the specified buffer containing
220 * the binary coded representation, starting at the specified offset.
222 * @param aBinaryData The encoded binary representation.
223 * @param aPos The offset position from which to start decoding.
224 * @return The new algorithm identifier object. */
225 IMPORT_C static CX509AlgorithmIdentifier* NewL(const TDesC8& aBinaryData, TInt& aPos);
227 /** Creates a new X.509 algorithm identifier object from the specified buffer containing
228 * the binary coded representation, starting at the specified offset, and puts
229 * a pointer to it onto the cleanup stack.
231 * @param aBinaryData The encoded binary representation.
232 * @param aPos The offset position from which to start decoding.
233 * @return The new algorithm identifier object. */
234 IMPORT_C static CX509AlgorithmIdentifier* NewLC(const TDesC8& aBinaryData, TInt& aPos);
237 Creates a X509 Algorithm Identifier object from the given algorithm ID and the encoded parameter.
238 @param aAlgorithmId The algorithm Id used to build the object.
239 @param aEncodedParams The encoded parameter for the algorithm ID.
240 @return The fully constructed object.
242 IMPORT_C static CX509AlgorithmIdentifier* NewL(TAlgorithmId aAlgorithmId, const TDesC8& aEncodedParams);
245 Creates a X509 Algorithm Identifier object from the given algorithm ID and the encoded parameter
246 and leaves the object on the cleanup stack.
247 @param aAlgorithmId The algorithm Id used to build the object.
248 @param aEncodedParams The encoded parameter for the algorithm ID.
249 @return The fully constructed object.
251 IMPORT_C static CX509AlgorithmIdentifier* NewLC(TAlgorithmId aAlgorithmId, const TDesC8& aEncodedParams);
254 Creates the ASN1 DER sequence of the X509 algorithm identifier object
255 and leaves it on the cleanup stack.
256 @return ASN1 DER sequence of this object.
258 IMPORT_C CASN1EncSequence* EncodeASN1DERLC() const;
261 CX509AlgorithmIdentifier();
262 CX509AlgorithmIdentifier(TAlgorithmId& aAlgorithmId);
263 void InitializeL(const TDesC8& aBinaryData, TInt& aPos);
266 class CX509SigningAlgorithmIdentifier : public CSigningAlgorithmIdentifier
267 /** Encapsulates the IDs of the algorithms used for signing an X.509 certificate.
274 /** Creates a new X.509 signing algorithm Id object from the specified buffer containing
275 * the binary coded representation.
277 * @param aBinaryData The encoded binary representation.
278 * @return The new signing algorithm Id object. */
279 IMPORT_C static CX509SigningAlgorithmIdentifier* NewL(const TDesC8& aBinaryData);
281 /** Creates a new X.509 signing algorithm Id object from the specified buffer containing
282 * the binary coded representation, and puts a pointer to it onto the cleanup stack.
284 * @param aBinaryData The encoded binary representation.
285 * @return The new signing algorithm Id object. */
286 IMPORT_C static CX509SigningAlgorithmIdentifier* NewLC(const TDesC8& aBinaryData);
288 /** Creates a new X.509 signing algorithm Id object from the specified buffer containing
289 * the binary coded representation, starting at the specified offset.
291 * @param aBinaryData The encoded binary representation.
292 * @param aPos The offset position from which to start decoding.
293 * @return The new signing algorithm Id object. */
294 IMPORT_C static CX509SigningAlgorithmIdentifier* NewL(const TDesC8& aBinaryData, TInt& aPos);
296 /** Creates a new X.509 signing algorithm Id object from the specified buffer containing
297 * the binary coded representation,starting at the specified offset, and puts
298 * a pointer to it onto the cleanup stack.
300 * @param aBinaryData The encoded binary representation.
301 * @param aPos The offset position from which to start decoding.
302 * @return The new signing algorithm Id object. */
303 IMPORT_C static CX509SigningAlgorithmIdentifier* NewLC(const TDesC8& aBinaryData, TInt& aPos);
304 /** Creates a new X.509 signing algorithm Id object from the specified algorithm pair
306 * @param aAsymmetricAlgorithm The asymmetric algorithm
307 * @param aDigestAlgorithm The digest algorithm
308 * @return The new signing algorithm Id object. */
309 IMPORT_C static CX509SigningAlgorithmIdentifier* NewL(const CAlgorithmIdentifier& aAsymmetricAlgorithm, const CAlgorithmIdentifier& aDigestAlgorithm);
310 /** Creates a new X.509 signing algorithm Id object from the specified algorithm pair
312 * @param aAsymmetricAlgorithm The asymmetric algorithm
313 * @param aDigestAlgorithm The digest algorithm
314 * @return The new signing algorithm Id object. */
315 IMPORT_C static CX509SigningAlgorithmIdentifier* NewLC(const CAlgorithmIdentifier& aAsymmetricAlgorithm, const CAlgorithmIdentifier& aDigestAlgorithm);
317 CX509SigningAlgorithmIdentifier();
318 void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
319 void ConstructL(const CAlgorithmIdentifier& aAsymmetricAlgorithm, const CAlgorithmIdentifier& aDigestAlgorithm);
322 class CX509SubjectPublicKeyInfo : public CSubjectPublicKeyInfo
323 /** X.509 subject public key information.
330 /** Creates a new X.509 subject public key object from the specified buffer containing
331 * the binary coded representation.
333 * @param aBinaryData The encoded binary representation.
334 * @return The new subject public key object. */
335 IMPORT_C static CX509SubjectPublicKeyInfo* NewL(const TDesC8& aBinaryData);
337 /** Creates a new X.509 subject public key object from the specified buffer containing
338 * the binary coded representation, and puts a pointer to it onto the cleanup stack.
340 * @param aBinaryData The encoded binary representation.
341 * @return The new subject public key object. */
342 IMPORT_C static CX509SubjectPublicKeyInfo* NewLC(const TDesC8& aBinaryData);
344 /** Creates a new X.509 subject public key object from the specified buffer containing
345 * the binary coded representation, starting at the specified offset.
347 * @param aBinaryData The encoded binary representation.
348 * @param aPos The offset position from which to start decoding.
349 * @return The subject public key object. */
350 IMPORT_C static CX509SubjectPublicKeyInfo* NewL(const TDesC8& aBinaryData, TInt& aPos);
352 /** Creates a new X.509 subject public key object from the specified buffer containing
353 * the binary coded representation, starting at the specified offset, and puts
354 * a pointer to it onto the cleanup stack.
356 * @param aBinaryData The encoded binary representation.
357 * @param aPos The offset position from which to start decoding.
358 * @return The new subject public key object. */
359 IMPORT_C static CX509SubjectPublicKeyInfo* NewLC(const TDesC8& aBinaryData, TInt& aPos);
361 CX509SubjectPublicKeyInfo();
362 void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
365 class CX509CertExtension : public CBase
366 /** A generic X.509 certificate extension.
368 * The creation of a generic extension is the first step in the creation of a
369 * specific extension. Client code gets the decoded Object Identifier (OID) encapsulated
370 * by an instance of this class and uses it to create the specific extension.
372 * Consists of an any-defined-by structure along with a boolean flag saying whether
373 * the extension is critical or not.
380 /** Creates a new generic X.509 certificate extension object from an existing object.
382 * This is equivalent to a copy constructor.
384 * @param aExtension The generic certificate extension to be copied.
385 * @return The new generic certificate extension object. */
386 IMPORT_C static CX509CertExtension* NewL(const CX509CertExtension& aExtension);
388 /** Creates a new generic X.509 certificate extension object from an existing object,
389 * and puts a pointer to it onto the cleanup stack.
391 * This is equivalent to a copy constructor.
393 * @param aExtension The generic certificate extension to be copied.
394 * @return The new generic X.509 certificate extension object. */
395 IMPORT_C static CX509CertExtension* NewLC(const CX509CertExtension& aExtension);
397 /** Creates a new generic X.509 certificate extension object from the specified
398 * buffer containing the binary coded representation.
400 * @param aBinaryData The encoded binary representation.
401 * @return The new generic X.509 certificate extension object. */
402 IMPORT_C static CX509CertExtension* NewL(const TDesC8& aBinaryData);
404 /** Creates a new generic X.509 certificate extension object from the specified
405 * buffer containing the binary coded representation, and puts a pointer to it
406 * onto the cleanup stack .
408 * @param aBinaryData The encoded binary representation.
409 * @return The new generic X.509 certificate extension object. */
410 IMPORT_C static CX509CertExtension* NewLC(const TDesC8& aBinaryData);
412 /** Creates a new generic X.509 certificate extension object from the specified
413 * buffer containing the binary coded representation, starting at the specified offset.
415 * @param aBinaryData The encoded binary representation.
416 * @param aPos The offset position from which to start decoding.
417 * @return The new generic X.509 certificate extension object. */
418 IMPORT_C static CX509CertExtension* NewL(const TDesC8& aBinaryData, TInt& aPos);
420 /** Creates a new generic X.509 certificate extension object from the specified
421 * buffer containing the binary coded representation, starting at the specified
422 * offset, and puts a pointer to it onto the cleanup stack.
424 * @param aBinaryData The encoded binary representation.
425 * @param aPos The offset position from which to start decoding.
426 * @return The new generic X.509 certificate extension object. */
427 IMPORT_C static CX509CertExtension* NewLC(const TDesC8& aBinaryData, TInt& aPos);
429 /** Creates a new generic X.509 certificate extension object from the specified
430 * extension object id, the critcal flag and the extension data.
432 * @param aCertExtOID The OID of the certficate extension.
433 * @param aCritical Flag to convey criticality of the extension.
434 * @param aCertExtValue The data of the specific extension.
435 * @return The new generic X.509 certificate extension object. */
436 IMPORT_C static CX509CertExtension* NewL(const TDesC& aCertExtOID,
437 const TBool aCritical,
438 const TDesC8& aCertExtValue);
440 /** Creates a new generic X.509 certificate extension object from the specified
441 * extension object id, the critcal flag and the extension data, and puts a
442 * pointer to it onto the cleanup stack.
444 * @param aCertExtOID The OID of the certficate extension.
445 * @param aCritical Flag to convey criticality of the extension.
446 * @param aCertExtValue The data of the specific extension.
447 * @return The new generic X.509 certificate extension object. */
448 IMPORT_C static CX509CertExtension* NewLC(const TDesC& aCertExtOID,
449 const TBool aCritical,
450 const TDesC8& aCertExtValue);
454 * Frees all resources owned by the object, prior to its destruction. */
455 IMPORT_C ~CX509CertExtension();
457 /** Tests whether certificate processing code must process this extension for certificate
458 * validation to succeed.
460 * @return ETrue, if this extension must be processed for validation to succeed;
461 * EFalse, otherwise. */
462 IMPORT_C TBool Critical() const;
464 /** Gets the Object Identifier (OID) of the certficate extension.
466 * @return The OID of the certficate extension. */
467 IMPORT_C TPtrC Id() const; //OID for the extension
469 /** Gets the encoded binary representation of the specific extension.
471 * @return A pointer descriptor representing the specific extension. */
472 IMPORT_C TPtrC8 Data() const; //the extension itself
474 /** Creates and returns a DER encoded X.509 certificate extension object in the form
475 * of a ASN.1 Sequence and puts it onto the cleanup stack. This method can be called
476 * repeatedly to get copies of the sequence.
478 * @return A pointer to a DER encoded ASN.1 sequence */
479 IMPORT_C CASN1EncSequence * EncodeASN1DERLC() const;
482 CX509CertExtension();
483 void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
484 void ConstructL(const CX509CertExtension& aExtension);
485 void ConstructL(const TDesC& aCertExtOID,
486 const TBool aCritical,
487 const TDesC8& aCertExtValue);
493 class CX509Certificate : public CCertificate
494 /** An X.509 certificate.
501 /** Enumerates values for encoded data element positions in the TBSCertificate data structure.
503 * These values are to be used as parameters to the DataElementEncoding() function. */
506 EVersionNumber = 0, //optional - may be NULL
512 ESubjectPublicKeyInfo = 6,
513 EIssuerUID = 7, //optional - may be NULL
514 ESubjectUID = 8, //optional - may be NULL
515 EExtensionList = 9 //optional - may be NULL
518 /** Creates a new X.509 certificate object from the specified buffer containing
519 * the binary coded representation.
521 * @param aBinaryData The encoded binary representation.
522 * @return The new X.509 certificate object. */
523 IMPORT_C static CX509Certificate* NewL(const TDesC8& aBinaryData);
525 /** Creates a new X.509 certificate object from the specified buffer containing
526 * the binary coded representation, and puts a pointer to it onto the cleanup stack.
528 * Initialises the object from its encoded binary form into an internal representation.
530 * @param aBinaryData The encoded binary representation.
531 * @return The new X.509 certificate object. */
532 IMPORT_C static CX509Certificate* NewLC(const TDesC8& aBinaryData);
534 /** Creates a new X.509 certificate object from the specified buffer containing
535 * the binary coded representation, starting at the specified offset.
537 * @param aBinaryData The encoded binary representation.
538 * @param aPos The offset position from which to start decoding.
539 * @return The new X.509 certificate object. */
540 IMPORT_C static CX509Certificate* NewL(const TDesC8& aBinaryData, TInt& aPos);
542 /** Creates a new X.509 certificate object from the specified buffer containing
543 * the binary coded representation, starting at the specified offset, and puts
544 * a pointer to it onto the cleanup stack.
546 * @param aBinaryData The encoded binary representation.
547 * @param aPos The offset position from which to start decoding.
548 * @return The new X.509 certificate object. */
549 IMPORT_C static CX509Certificate* NewLC(const TDesC8& aBinaryData, TInt& aPos);
551 /** Creates a new X.509 certificate object from the specified read stream.
553 * @param aStream Stream from which the contents should be internalised.
554 * @return The new X.509 certificate object. */
555 IMPORT_C static CX509Certificate* NewL(RReadStream& aStream);
557 /** Creates a new X.509 certificate object from the specified read stream, and
558 * puts a pointer to it onto the cleanup stack.
560 * Construction is from the stream.
562 * @param aStream Stream from which the contents should be internalised.
563 * @return The new X.509 certificate object. */
564 IMPORT_C static CX509Certificate* NewLC(RReadStream& aStream);
566 /** Creates a new X.509 certificate object from an existing object.
568 * This is equivalent to a copy constructor.
570 * @param aCert The X.509 certificate to be copied.
571 * @return The new X.509 certificate object. */
572 IMPORT_C static CX509Certificate* NewL(const CX509Certificate& aCert);
574 /** Creates a new X.509 certificate object from an existing object.
576 * This is equivalent to a copy constructor.
578 * @param aCert The X.509 certificate to be copied.
579 * @return The new X.509 certificate object. */
580 IMPORT_C static CX509Certificate* NewLC(const CX509Certificate& aCert);
584 * Frees all resources owned by the object, prior to its destruction. */
585 IMPORT_C ~CX509Certificate();
587 /** Tests whether the specified X.509 certificate is equal to this X.509 certificate.
589 * X.509 certificates are equal if both the serial number and the issuer name
592 * @param aCert The X.509 certificate to be compared.
593 * @return ETrue, if the certificates are equal;EFalse, otherwise. */
594 IMPORT_C TBool IsEqualL(const CX509Certificate& aCert) const;
597 /** Gets the certificate's signed data.
599 * @return A non-modifiable pointer descriptor representing the certificate's
601 IMPORT_C const TPtrC8 SignedDataL() const;
603 /** Gets the version number of the certificate.
605 * @return The version number of the certificate. */
606 IMPORT_C TInt Version() const;
608 /** Gets the X.500 Distinguished Name that identifies the issuer.
610 * @return The X.500 Distinguished Name that identifies the issuer. */
611 IMPORT_C const CX500DistinguishedName& IssuerName() const;
613 /** Gets the X.500 Distinguished Name that identifies the subject.
615 * @return The X.500 Distinguished Name that identifies the subject. */
616 IMPORT_C const CX500DistinguishedName& SubjectName() const;
618 //return all your generic extensions
619 /** Gets all generic certificate extensions.
621 * @return The certificate extensions. */
622 IMPORT_C const CArrayPtrFlat<CX509CertExtension>& Extensions() const;
624 //return a particular extension: this is NOT OWNED by the client
625 //returns NULL if the ext is not found
626 /** Gets the certificate extension identified by the specified object identifier (OID).
628 * @param aExtensionName The OID identifying the extension.
629 * @return The certificate extension: Note that ownership is not transferred to
631 IMPORT_C const CX509CertExtension* Extension(const TDesC& aExtensionName) const;
633 /** Internalises an object of this class from a read stream.
635 * The presence of this function means that the standard templated operator>>()
636 * can be used to internalise objects of this class.
638 * Note that the function has assignment semantics. It replaces the old value
639 * of the object with a new value read from the read stream.
641 * @param aStream Stream from which the object is to be internalised. */
642 IMPORT_C void InternalizeL(RReadStream& aStream);
644 //return the encoding for a data element at the index specified
645 /** Gets the encoded data for the specified encoded data element (in the To Be
646 * Signed (TBS) certificate data structure) of the signed object.
648 * @param aIndex The encoded data element position in the TBSCertificate data
649 * structure. (See the CX509Certificate enumeration.)
650 * @return The encoded data for the specified data element of the signed object.
652 IMPORT_C virtual const TPtrC8* DataElementEncoding(const TUint aIndex) const;
654 public: // from CCertificate
655 /** Gets the issuer of the certificate.
657 * @return A heap descriptor representing the issuer of the certificate. */
658 IMPORT_C HBufC* IssuerL() const;
660 /** Gets the subject of the certificate.
662 * @return A heap descriptor representing the issuer of the certificate. */
663 IMPORT_C HBufC* SubjectL() const;
665 /** Tests whether the certificate is self-signed.
667 * @return ETrue, if it is self-signed; EFalse, otherwise. */
668 IMPORT_C TBool IsSelfSignedL() const;
670 /** Gets a key identifier for the certificate. This is a unique identifier, calculated according
671 * to the recommended method of computing it from RFC3280, section 4.2.1.2. Please note that this
672 * method does NOT return the value of the Subject Key Id extension, if it is present.
674 * @return A unique key identifier for the certificate. */
675 IMPORT_C TKeyIdentifier KeyIdentifierL() const;
677 /** Gets the subject key identifier for the certificate. This identifier is extracted from the
678 * certificate (if the corresponding extension exists), or calculated (if the extension doesn't exist). If calculated, the recommendation from
679 * section 4.2.1.2, RFC3280 is used (hash of the public key). Please note, that for subject key ids
680 * extracted from the certificate there is a length limit - if the extension is longer than 160 bits,
681 * it is ignored and the value is calculated instead.
683 * @return The subject key identifier for the certificate. */
684 IMPORT_C TKeyIdentifier SubjectKeyIdentifierL() const;
688 void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
689 void ConstructL(const CX509Certificate& aCertificate);
690 void ConstructCertL();
691 void InitDataElementsL(const CX509Certificate& aCertificate);
692 HBufC8* DecodeUidL(const TDesC8& aBinaryData, TBool& aHasElementAlready);
693 void DecodeExtsL(const TDesC8& aBinaryData, TBool& aHasElementAlready);
696 CX500DistinguishedName* iIssuerName;
697 CX500DistinguishedName* iSubjectName;
700 CArrayPtrFlat<CX509CertExtension>* iExtensions;
701 TFixedArray<TPtrC8*, KX509MaxDataElements>* iDataElements;