sl@0: /* sl@0: * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * X509CERTEXT.H sl@0: * X509 extensions v2 sl@0: * Common specific extensions: sl@0: * 1) basic constraints sl@0: * 2) alt name sl@0: * 3) key usage sl@0: * 4) name constraints sl@0: * 5) policy constraints sl@0: * 6) policies sl@0: * 7) policy mapping sl@0: * 8) authority key ID sl@0: * 9) subject key ID sl@0: * 10) extended key usage sl@0: * 11) authority information access sl@0: * critical extension sl@0: * 12) inhibit-any policy sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: sl@0: #if !defined (__X509CERTEXT_H__) sl@0: #define __X509CERTEXT_H__ sl@0: sl@0: #include <e32base.h> sl@0: #include <e32std.h> sl@0: #include <x509gn.h> sl@0: sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include <x509bitstring.h> sl@0: #endif sl@0: sl@0: class RReadStream; sl@0: class RWriteStream; sl@0: class CX509BitString; sl@0: /** A list of values that defines what an X.509 key can be used for. sl@0: * These values can be ANDed together if a key has several usages. sl@0: * sl@0: * @since v7.0 */ sl@0: enum TX509KeyUsage sl@0: { sl@0: /** A digital signature. */ sl@0: EX509DigitalSignature, sl@0: /** Non repudiation. */ sl@0: EX509NonRepudiation, sl@0: /** Key encipherment. */ sl@0: EX509KeyEncipherment, sl@0: /** Data encipherment. */ sl@0: EX509DataEncipherment, sl@0: /** Key agreement. */ sl@0: EX509KeyAgreement, sl@0: /** Key certificate sign. */ sl@0: EX509KeyCertSign, sl@0: /** CRL sign. */ sl@0: EX509CRLSign, sl@0: /** Encipher only. */ sl@0: EX509EncipherOnly, sl@0: /** Decipher only. */ sl@0: EX509DecipherOnly sl@0: }; sl@0: sl@0: /** X509 Extension OIDs sl@0: * sl@0: * @since v9.5 */ sl@0: sl@0: //OIDS for the extensions we define here... sl@0: _LIT(KBasicConstraints,"2.5.29.19"); sl@0: _LIT(KSubjectAltName,"2.5.29.17"); sl@0: _LIT(KIssuerAltName,"2.5.29.18"); sl@0: _LIT(KKeyUsage,"2.5.29.15"); sl@0: _LIT(KNameConstraints,"2.5.29.30"); sl@0: _LIT(KPolicyConstraints,"2.5.29.36"); sl@0: _LIT(KCertPolicies,"2.5.29.32"); sl@0: _LIT(KPolicyMapping,"2.5.29.33"); sl@0: _LIT(KAuthorityKeyId,"2.5.29.35"); sl@0: _LIT(KSubjectKeyId,"2.5.29.14"); sl@0: _LIT(KExtendedKeyUsage,"2.5.29.37"); sl@0: _LIT(KAuthorityInfoAccess, "1.3.6.1.5.5.7.1.1"); sl@0: _LIT(KInhibitAnyPolicy, "2.5.29.54"); sl@0: sl@0: // OIDs for access methods sl@0: _LIT(KAccessMethodOCSP, "1.3.6.1.5.5.7.48.1"); sl@0: sl@0: //deprecated OIDs we might still encounter sl@0: _LIT(KOldBasicConstraints,"2.5.29.10"); sl@0: _LIT(KOldBasicConstraints2,"2.5.29.13"); sl@0: _LIT(KOldSubjectAltName,"2.5.29.7"); sl@0: _LIT(KOldIssuerAltName,"2.5.29.8"); sl@0: _LIT(KOldNameConstraints,"2.5.29.11"); sl@0: _LIT(KOldPolicyConstraints,"2.5.29.2"); sl@0: _LIT(KOldPolicyConstraints2,"2.5.29.34"); sl@0: _LIT(KOldCertPolicies,"2.5.29.3"); sl@0: _LIT(KOldPolicyMapping,"2.5.29.5"); sl@0: _LIT(KOldAuthorityKeyId,"2.5.29.1"); sl@0: sl@0: // Define OIDs for Symbian certificate constraints. sl@0: _LIT(KDeviceIdListConstraint,"1.2.826.0.1.1796587.1.1.1.1"); sl@0: _LIT(KSidListConstraint,"1.2.826.0.1.1796587.1.1.1.4"); sl@0: _LIT(KVidListConstraint,"1.2.826.0.1.1796587.1.1.1.5"); sl@0: _LIT(KCapabilitiesConstraint,"1.2.826.0.1.1796587.1.1.1.6"); sl@0: sl@0: //1) basic constraints... sl@0: sl@0: class CX509ExtensionBase : public CBase sl@0: /** A certificate extension base class. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: protected: sl@0: /** Second-phase constructor. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The position from which to start decoding. */ sl@0: virtual void ConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Implementation for second-phase construction. sl@0: * sl@0: * This is called by ConstructL(). sl@0: * sl@0: * @param aBinaryData The encoded binary representation. This is the same as sl@0: * passed to ConstructL(). sl@0: * @param aPos The position from which to start decoding. Note that the value sl@0: * passed points, in effect, to the content, by passing the header data. */ sl@0: virtual void DoConstructL(const TDesC8& aBinaryData, TInt& aPos) = 0; sl@0: }; sl@0: sl@0: class CX509BasicConstraintsExt : public CX509ExtensionBase sl@0: /** An X.509 certificate extension that defines basic constraints. sl@0: * sl@0: * It indicates whether the certificate belongs to a Certificate Authority or sl@0: * an end Entity. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** Creates a new CX509BasicConstraintsExt object from the specified sl@0: * buffer containing the binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509BasicConstraintsExt object. */ sl@0: IMPORT_C static CX509BasicConstraintsExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509BasicConstraintsExt object from the specified sl@0: * buffer containing the binary coded representation, and puts a pointer to it sl@0: * onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509BasicConstraintsExt object. */ sl@0: IMPORT_C static CX509BasicConstraintsExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509BasicConstraintsExt object from the specified sl@0: * buffer containing the binary coded representation, starting at the specified sl@0: * offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509BasicConstraintsExt object. */ sl@0: IMPORT_C static CX509BasicConstraintsExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509BasicConstraintsExt object from the specified sl@0: * buffer containing the binary coded representation, starting at the specified sl@0: * offset, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509BasicConstraintsExt object. */ sl@0: IMPORT_C static CX509BasicConstraintsExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object, prior to its destruction. */ sl@0: virtual ~CX509BasicConstraintsExt(); sl@0: sl@0: /** Tests whether the certificate belongs to a Certificate Authority. sl@0: * sl@0: * @return ETrue, if the certificate belongs to a Certificate Authority; sl@0: * EFalse, otherwise. */ sl@0: IMPORT_C TBool IsCA() const; sl@0: sl@0: /** Gets the maximum number of certificates that can follow this one in the chain. sl@0: * sl@0: * @return The number of certificates. */ sl@0: IMPORT_C TInt MaxChainLength() const;//0 if not set sl@0: private: sl@0: CX509BasicConstraintsExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: TBool iIsCA; sl@0: TInt iMaxChainLen; sl@0: }; sl@0: sl@0: //2) alt name sl@0: sl@0: class CX509AltNameExt : public CX509ExtensionBase sl@0: /** An X.509 certificate extension that defines an alternate name. sl@0: * sl@0: * It appears as an Issuer Alt Name extension or a Subject Alt Name extension sl@0: * and is used to contain extra identifying information that will not fit into sl@0: * a Distinguished Name. sl@0: * sl@0: * It consists of an array of X.509 General Names. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** Creates a new CX509AltNameExt object from the specified sl@0: * buffer containing the binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509AltNameExt object. */ sl@0: IMPORT_C static CX509AltNameExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509AltNameExt object from the specified sl@0: * buffer containing the binary coded representation, and puts a pointer to it sl@0: * onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509AltNameExt object. */ sl@0: IMPORT_C static CX509AltNameExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509AltNameExt object from the specified sl@0: * buffer containing the binary coded representation, starting at the specified sl@0: * offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509AltNameExt object. */ sl@0: IMPORT_C static CX509AltNameExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509AltNameExt object from the specified sl@0: * buffer containing the binary coded representation, starting at the specified sl@0: * offset, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509AltNameExt object. */ sl@0: IMPORT_C static CX509AltNameExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object, prior to its destruction. */ sl@0: virtual ~CX509AltNameExt(); sl@0: sl@0: /** Gets a reference to the array of general names that forms the alternate name sl@0: * extension. sl@0: * sl@0: * @return The array of general names. */ sl@0: IMPORT_C const CArrayPtrFlat<CX509GeneralName>& AltName() const; sl@0: sl@0: /** Checks whether the corressponding elements of two equally sized arrays of X.509 general names sl@0: * match. sl@0: * sl@0: * @param aExt An X.509 certificate extension object that defines an alternate name. sl@0: * @return TRUE if all the elements in the arrays match. sl@0: */ sl@0: IMPORT_C TBool Match(const CX509AltNameExt& aExt) const; sl@0: private: sl@0: CX509AltNameExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: CArrayPtrFlat<CX509GeneralName>* iAuthorityName; sl@0: }; sl@0: sl@0: class CX509KeyUsageExt : public CX509ExtensionBase sl@0: /** An X.509 certificate extension that defines the uses to which a key may be put. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** Creates a new CX509KeyUsageExt object from the specified buffer sl@0: * containing the binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509KeyUsageExt object. */ sl@0: IMPORT_C static CX509KeyUsageExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509KeyUsageExt object from the specified buffer sl@0: * containing the binary coded representation, and puts a pointer to it onto sl@0: * the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509KeyUsageExt object. */ sl@0: IMPORT_C static CX509KeyUsageExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509KeyUsageExt object from the specified buffer sl@0: * containing the binary coded representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509KeyUsageExt object. */ sl@0: IMPORT_C static CX509KeyUsageExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509KeyUsageExt object from the specified buffer sl@0: * containing the binary coded representation, starting at the specified offset, sl@0: * and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509KeyUsageExt object. */ sl@0: IMPORT_C static CX509KeyUsageExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object, prior to its destruction. */ sl@0: virtual ~CX509KeyUsageExt(); sl@0: sl@0: /** Tests whether a particular usage is set in the extension. sl@0: * sl@0: * sl@0: * @param aUsage The usage. sl@0: * @return ETrue, if the specific usage is set in the extension; EFalse, otherwise. */ sl@0: IMPORT_C TBool IsSet(TX509KeyUsage aUsage) const; sl@0: private: sl@0: CX509KeyUsageExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: CX509BitString* iData; sl@0: }; sl@0: sl@0: //4) name constraints sl@0: sl@0: class CX509GeneralSubtree : public CBase sl@0: /** Provides access to the general name and the min/max lengths of the subtree. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509GeneralSubtree object from the specified buffer containing sl@0: * the encoded binary representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509GeneralSubtree object. sl@0: **/ sl@0: static CX509GeneralSubtree* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509GeneralSubtree object from the specified buffer containing sl@0: * the encoded binary representation, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509GeneralSubtree object. sl@0: **/ sl@0: static CX509GeneralSubtree* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509GeneralSubtree object from the specified buffer containing sl@0: * the encoded binary representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The position from which to start decoding. sl@0: * @return The new CX509GeneralSubtree object. sl@0: **/ sl@0: static CX509GeneralSubtree* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509GeneralSubtree object from the specified buffer containing sl@0: * the encoded binary representation, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The position from which to start decoding. sl@0: * @return The new CX509GeneralSubtree object. sl@0: **/ sl@0: static CX509GeneralSubtree* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object. */ sl@0: virtual ~CX509GeneralSubtree(); sl@0: sl@0: /** Gets the general name. sl@0: * sl@0: * @return The general name. */ sl@0: IMPORT_C const CX509GeneralName& Name() const; sl@0: sl@0: /** Gets the minimum distance of the CX509GeneralSubtree object. sl@0: * sl@0: * @return The minimum distance of the CX509GeneralSubtree object. */ sl@0: IMPORT_C TInt MinDistance() const; sl@0: sl@0: /** Gets the maximum distance of the CX509GeneralSubtree object. sl@0: * sl@0: * @return The maximum distance of the CX509GeneralSubtree object. */ sl@0: IMPORT_C TInt MaxDistance() const; sl@0: private: sl@0: CX509GeneralSubtree(); sl@0: void ConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: CX509GeneralName* iName; sl@0: TInt iMaxDist; sl@0: TInt iMinDist; sl@0: }; sl@0: sl@0: class CX509NameConstraintsExt : public CX509ExtensionBase sl@0: /** An X.509 certificate extension that defines constraints on an entity's name. sl@0: * sl@0: * This extension allows Certification Authorities to restrict or prevent the issuing sl@0: * of certificates to entities whose names lie within a defined name space. sl@0: * sl@0: */ sl@0: { sl@0: public: sl@0: /** Creates a new CX509NameConstraintsExt object from the specified sl@0: * buffer containing the binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509NameConstraintsExt object. */ sl@0: IMPORT_C static CX509NameConstraintsExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509NameConstraintsExt object from the specified sl@0: * buffer containing the binary coded representation, and puts a pointer to it sl@0: * onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509NameConstraintsExt object. */ sl@0: IMPORT_C static CX509NameConstraintsExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509NameConstraintsExt object from the specified sl@0: * buffer containing the binary coded representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509NameConstraintsExt object. */ sl@0: IMPORT_C static CX509NameConstraintsExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509NameConstraintsExt object from the specified sl@0: * buffer containing the binary coded representation, starting at the specified sl@0: * offset, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509NameConstraintsExt object. */ sl@0: IMPORT_C static CX509NameConstraintsExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object, prior to its destruction. */ sl@0: IMPORT_C ~CX509NameConstraintsExt(); sl@0: sl@0: /** Gets a reference to the array of exclusion subtree names. sl@0: * sl@0: * No certificates after this one may contain names within the subtrees specified. sl@0: * sl@0: * @return The excluded subtrees. */ sl@0: IMPORT_C const CArrayPtrFlat<CX509GeneralSubtree>& ExcludedSubtrees() const; sl@0: sl@0: /** Gets a reference to the array of permitted subtree names. sl@0: * sl@0: * All certificates after this one must contain names within the subtrees specified. sl@0: * sl@0: * @return The permitted subtrees. */ sl@0: IMPORT_C const CArrayPtrFlat<CX509GeneralSubtree>& PermittedSubtrees() const; sl@0: private: sl@0: CX509NameConstraintsExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: void AddSubtreesL(CArrayPtrFlat<CX509GeneralSubtree>& aSubtrees, const TDesC8& aBinaryData); sl@0: CArrayPtrFlat<CX509GeneralSubtree>* iExcludedSubtrees; sl@0: CArrayPtrFlat<CX509GeneralSubtree>* iPermittedSubtrees; sl@0: }; sl@0: sl@0: //5) policy constraints sl@0: sl@0: class TX509PolicyConstraint sl@0: /** Defines whether a policy constraint applies. sl@0: * sl@0: * Objects of this type are used by the X.509 certificate extension that constrains sl@0: * the use of policies. sl@0: * sl@0: * An object of this type encapsulates two pieces of information: sl@0: * @li whether a specific policy applies to subsequent certificates sl@0: * @li if a specific policy applies, the number of certificates that can follow the sl@0: * current one before the policy constraint applies. sl@0: * sl@0: * Enables a CA to constrain the use of policies in two ways: they can enforce sl@0: * the appearance of explicit certificate policies in subsequent certificates, sl@0: * and prevent policy mapping from being performed. sl@0: * sl@0: */ sl@0: { sl@0: public: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Constructs a TX509PolicyConstraint definition object with the specified requirement sl@0: * and countdown values. sl@0: * sl@0: * @param aRequired The policy requirement. Set to ETrue, if the policy constraint sl@0: * applies; set to EFalse, otherwise. sl@0: * @param aCountdown The countdown value. This is the number of certificates that sl@0: * can follow the current one before the constraint applies. sl@0: * This only has meaning if the policy constraint applies. sl@0: **/ sl@0: TX509PolicyConstraint(TBool aRequired, TInt aCountdown); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Default constructor. sl@0: * sl@0: * Sets policy requirement to EFalse and iRequired to EFalse and the iCountdown sl@0: * to zero. sl@0: **/ sl@0: TX509PolicyConstraint(); sl@0: sl@0: /** The policy requirement. sl@0: * sl@0: * This has the value ETrue, if the policy constraint applies; EFalse otherwise. */ sl@0: TBool iRequired; sl@0: sl@0: /** The count down value. sl@0: * sl@0: * Defines the number of certificates that can follow the current one before sl@0: * the policy constraint applies. This has no meaning if the policy constraint sl@0: * does not apply. */ sl@0: TInt iCountdown; sl@0: }; sl@0: sl@0: class CX509PolicyConstraintsExt : public CX509ExtensionBase sl@0: /** Enables a Certification Authority to constrain the use of policies in two ways: sl@0: * @li to enforce the appearance of explicit certificate policies in subsequent certificates sl@0: * @li to prevent policy mapping from being performed. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** Creates a new CX509PolicyConstraintsExt object from the specified buffer sl@0: * containing the encoded binary representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509PolicyConstraintsExt object. */ sl@0: IMPORT_C static CX509PolicyConstraintsExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new Policy constraints extension object from the specified buffer sl@0: * containing the encoded binary representation, and puts a pointer to it onto sl@0: * the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509PolicyConstraintsExt object. */ sl@0: IMPORT_C static CX509PolicyConstraintsExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509PolicyConstraintsExt object from the specified buffer sl@0: * containing the encoded binary representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509PolicyConstraintsExt object. */ sl@0: IMPORT_C static CX509PolicyConstraintsExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509PolicyConstraintsExt object from the specified buffer sl@0: * containing the encoded binary representation, and puts a pointer to it onto sl@0: * the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509PolicyConstraintsExt object. */ sl@0: IMPORT_C static CX509PolicyConstraintsExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object, prior to its destruction. */ sl@0: IMPORT_C ~CX509PolicyConstraintsExt(); sl@0: sl@0: /** Gets the explicit policy constraint. sl@0: * sl@0: * @return The explicit policy constraint. */ sl@0: IMPORT_C TX509PolicyConstraint ExplicitPolicyRequired() const; sl@0: sl@0: /** Gets the inhibiting policy mapping. sl@0: * sl@0: * @return The inhibiting policy mapping. */ sl@0: IMPORT_C TX509PolicyConstraint InhibitPolicyMapping() const; sl@0: private: sl@0: CX509PolicyConstraintsExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: TX509PolicyConstraint iRequirePolicy; sl@0: TX509PolicyConstraint iInhibitPolicyMapping; sl@0: }; sl@0: sl@0: //6) policies sl@0: sl@0: class CX509PolicyQualifierInfo : public CBase sl@0: /** Gets X.509 policy qualifier information. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyQualifierInfo object from the specified sl@0: * buffer containing the encoded binary representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509PolicyQualifierInfo object. sl@0: **/ sl@0: static CX509PolicyQualifierInfo* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyQualifierInfo object from the specified sl@0: * buffer containing the encoded binary representation, and puts a pointer to sl@0: * it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509PolicyQualifierInfo object. sl@0: **/ sl@0: static CX509PolicyQualifierInfo* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyQualifierInfo object from the specified sl@0: * buffer containing the encoded binary representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The position from which to start decoding. sl@0: * @return The new CX509PolicyQualifierInfo object. sl@0: **/ sl@0: static CX509PolicyQualifierInfo* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyQualifierInfo object from the specified sl@0: * buffer containing the encoded binary representation, and puts a pointer to sl@0: * it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The position from which to start decoding. sl@0: * @return The new CX509PolicyQualifierInfo object. sl@0: **/ sl@0: static CX509PolicyQualifierInfo* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyQualifierInfo object from an existing X.509 sl@0: * Policy Qualifier Information object. sl@0: * sl@0: * @param aQualifierInfo The CX509PolicyQualifierInfo object to be copied. sl@0: * @return The new CX509PolicyQualifierInfo object. sl@0: **/ sl@0: static CX509PolicyQualifierInfo* NewL(const CX509PolicyQualifierInfo& aQualifierInfo); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyQualifierInfo object from an existing X.509 sl@0: * Policy Qualifier Information object, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aQualifierInfo The CX509PolicyQualifierInfo object to be copied. sl@0: * @return The new CX509PolicyQualifierInfo object. sl@0: **/ sl@0: static CX509PolicyQualifierInfo* NewLC(const CX509PolicyQualifierInfo& aQualifierInfo); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyQualifierInfo object from a stream. sl@0: * sl@0: * @return The new CX509PolicyQualifierInfo object. sl@0: **/ sl@0: static CX509PolicyQualifierInfo* NewL(RReadStream& aStream); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyQualifierInfo object from a stream, and puts a pointer to it onto sl@0: * the cleanup stack. sl@0: * sl@0: * @return The new CX509PolicyQualifierInfo object. sl@0: **/ sl@0: static CX509PolicyQualifierInfo* NewLC(RReadStream& aStream); sl@0: sl@0: /** The destructor. sl@0: * sl@0: * Frees all resources owned by the object. */ sl@0: virtual ~CX509PolicyQualifierInfo(); sl@0: sl@0: /** Gets the policy qualifier Id. sl@0: * sl@0: * @return A non-modifiable pointer descriptor representing the policy qualifier Id. */ sl@0: IMPORT_C TPtrC Id() const; sl@0: sl@0: /** Gets the policy qualifier data. sl@0: * sl@0: * @return A non-modifiable pointer descriptor representing the policy qualifier data. */ sl@0: IMPORT_C TPtrC8 Data() const; sl@0: sl@0: // Internalization/Externalization sl@0: // Externalize. Writes the data out to a stream sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Externalises an object of this class to a write stream. sl@0: * sl@0: * The presence of this function means that the standard templated operator<<() sl@0: * can be used to externalise objects of this class. sl@0: * sl@0: * @param aStream Stream to which the object should be externalised. sl@0: **/ sl@0: void ExternalizeL(RWriteStream& aStream) const; sl@0: sl@0: // Internalize. Reads the data from a stream sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Internalises an object of this class from a read stream. sl@0: * sl@0: * The presence of this function means that the standard templated operator>>() sl@0: * can be used to internalise objects of this class. sl@0: * sl@0: * Note that this function has assignment semantics: it replaces the old value sl@0: * of the object with a new value read from the read stream. sl@0: * sl@0: * @param aStream Stream from which the object should be internalised. sl@0: **/ sl@0: void InternalizeL(RReadStream& aStream); sl@0: sl@0: private: sl@0: CX509PolicyQualifierInfo(); sl@0: void ConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: void ConstructL(const CX509PolicyQualifierInfo& aQualifier); sl@0: void ConstructL(RReadStream& aStream); sl@0: HBufC* iPolicyQualifierId; sl@0: HBufC8* iData; //opaque (this is another any-defined-by, so could be anything) sl@0: }; sl@0: sl@0: class CX509CertPolicyInfo : public CBase sl@0: /** Defines a specific policy followed by a Certification Authority. sl@0: * sl@0: * The policy under which a certificate has been issued may contain a number sl@0: * of these specific policies. sl@0: * sl@0: * @see CX509CertPoliciesExt sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509CertPolicyInfo object from the specified buffer containing the sl@0: * binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509CertPolicyInfo object. sl@0: **/ sl@0: static CX509CertPolicyInfo* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509CertPolicyInfo object from the specified buffer containing the sl@0: * binary coded representation, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509CertPolicyInfo object. sl@0: **/ sl@0: static CX509CertPolicyInfo* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * Creates a new CX509CertPolicyInfo object from the specified buffer containing the sl@0: * binary coded representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509CertPolicyInfo object. sl@0: **/ sl@0: static CX509CertPolicyInfo* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509CertPolicyInfo object from the specified buffer containing the sl@0: * binary coded representation, starting at the specified offset, and puts a sl@0: * pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509CertPolicyInfo object. sl@0: **/ sl@0: static CX509CertPolicyInfo* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509CertPolicyInfo object from an existing object. sl@0: * sl@0: * This is equivalent to a copy constructor. sl@0: * sl@0: * @param aPolicy The CX509CertPolicyInfo object to be copied. sl@0: * @return The new CX509CertPolicyInfo object. */ sl@0: IMPORT_C static CX509CertPolicyInfo* NewL(const CX509CertPolicyInfo& aPolicy); sl@0: sl@0: /** Creates a new CX509CertPolicyInfo object from an existing object, and puts a pointer sl@0: * to it onto the cleanup stack. sl@0: * sl@0: * This is equivalent to a copy constructor. sl@0: * sl@0: * @param aPolicy The CX509CertPolicyInfo object to be copied. sl@0: * @return The new CX509CertPolicyInfo object. */ sl@0: IMPORT_C static CX509CertPolicyInfo* NewLC(const CX509CertPolicyInfo& aPolicy); sl@0: sl@0: /** Creates a new CX509CertPolicyInfo object from a stream. sl@0: * sl@0: * @return The new CX509CertPolicyInfo object. */ sl@0: IMPORT_C static CX509CertPolicyInfo* NewL(RReadStream& aStream); sl@0: sl@0: /** Creates a new CX509CertPolicyInfo object from a stream, and puts a pointer to it onto sl@0: * the cleanup stack. sl@0: * sl@0: * @return The new CX509CertPolicyInfo object. */ sl@0: IMPORT_C static CX509CertPolicyInfo* NewLC(RReadStream& aStream); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object, prior to its destruction. */ sl@0: virtual ~CX509CertPolicyInfo(); sl@0: sl@0: /** Gets a reference to the array of policy qualifers. sl@0: * sl@0: * @return The array of policy qualifiers. */ sl@0: IMPORT_C const CArrayPtrFlat<CX509PolicyQualifierInfo>& Qualifiers() const; sl@0: sl@0: /** Gets the specific policy's Object Identifier (OID). sl@0: * sl@0: * @return A pointer descriptor representing the specific policy's OID. */ sl@0: IMPORT_C TPtrC Id() const; sl@0: sl@0: sl@0: // Internalization/Externalization sl@0: // Externalize. Writes the data out to a stream sl@0: /** Externalises an object of this class to a write stream. sl@0: * sl@0: * The presence of this function means that the standard templated operator<<() sl@0: * can be used to externalise objects of this class. sl@0: * sl@0: * @param aStream Stream to which the object should be externalised. */ sl@0: IMPORT_C void ExternalizeL(RWriteStream& aStream) const; sl@0: sl@0: // Internalize. Reads the data from a stream sl@0: /** Internalises an object of this class from a read stream. sl@0: * sl@0: * The presence of this function means that the standard templated operator>>() sl@0: * can be used to internalise objects of this class. sl@0: * sl@0: * Note that this function has assignment semantics: it replaces the old value sl@0: * of the object with a new value read from the read stream. sl@0: * sl@0: * @param aStream Stream from which the object should be internalised. */ sl@0: IMPORT_C void InternalizeL(RReadStream& aStream); sl@0: sl@0: sl@0: private: sl@0: CX509CertPolicyInfo(); sl@0: void ConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: void ConstructL(const CX509CertPolicyInfo& aInfo); sl@0: void ConstructL(RReadStream& aStream); sl@0: HBufC* iCertPolicyId;//OID for this policy sl@0: CArrayPtrFlat<CX509PolicyQualifierInfo>* iQualifiers; sl@0: }; sl@0: sl@0: class CX509CertPoliciesExt : public CX509ExtensionBase sl@0: /** The policy under which this certificate has been issued. sl@0: * sl@0: * Contains further information on a client's signature. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** Creates a new CX509CertPoliciesExt object from the specified buffer sl@0: * containing the encoded binary representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The CX509CertPoliciesExt object. */ sl@0: IMPORT_C static CX509CertPoliciesExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509CertPoliciesExt object from the specified buffer sl@0: * containing the encoded binary representation, and puts a pointer to it onto sl@0: * the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The CX509CertPoliciesExt object. */ sl@0: IMPORT_C static CX509CertPoliciesExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509CertPoliciesExt object from the specified buffer sl@0: * containing the encoded binary representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The CX509CertPoliciesExt object. */ sl@0: IMPORT_C static CX509CertPoliciesExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509CertPoliciesExt object from the specified buffer sl@0: * containing the encoded binary representation, and puts a pointer to it onto sl@0: * the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The CX509CertPoliciesExt object. */ sl@0: IMPORT_C static CX509CertPoliciesExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object. */ sl@0: virtual ~CX509CertPoliciesExt(); sl@0: sl@0: /** Gets the certificate policy extension information. sl@0: * sl@0: * @return The certificate policy extension information. */ sl@0: IMPORT_C const CArrayPtrFlat<CX509CertPolicyInfo>& Policies() const; sl@0: private: sl@0: CX509CertPoliciesExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: CArrayPtrFlat<CX509CertPolicyInfo>* iPolicies; sl@0: }; sl@0: sl@0: //7) policy mapping sl@0: sl@0: class CX509PolicyMapping : public CBase sl@0: /** A set of policy mappings. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyMapping object from the specified buffer containing sl@0: * the encoded binary representation, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: **/ sl@0: static CX509PolicyMapping* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyMapping object from the specified buffer containing sl@0: * the encoded binary representation, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: **/ sl@0: static CX509PolicyMapping* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyMapping object from the specified buffer containing sl@0: * the encoded binary representation, starting at the specified offset, and puts sl@0: * a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The position from which to start decoding. sl@0: **/ sl@0: static CX509PolicyMapping* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509PolicyMapping object from the specified buffer containing sl@0: * the encoded binary representation, starting at the specified offset, and puts sl@0: * a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The position from which to start decoding. sl@0: **/ sl@0: static CX509PolicyMapping* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509PolicyMapping object copied from an existing one. sl@0: * sl@0: * @param aMapping The CX509PolicyMapping object to be copied. */ sl@0: IMPORT_C static CX509PolicyMapping* NewL(const CX509PolicyMapping& aMapping); sl@0: sl@0: /** Creates a new CX509PolicyMapping object copied from an existing one, and sl@0: * puts a pointer to the object onto the cleanup stack. sl@0: * sl@0: * @param aMapping The CX509PolicyMapping object to be copied. */ sl@0: IMPORT_C static CX509PolicyMapping* NewLC(const CX509PolicyMapping& aMapping); sl@0: sl@0: /** The destructor. sl@0: * sl@0: * Frees all resources owned by the object. */ sl@0: virtual ~CX509PolicyMapping(); sl@0: sl@0: /** Gets the issuer policy. sl@0: * sl@0: * @return The issuer policy. */ sl@0: IMPORT_C TPtrC IssuerPolicy() const; sl@0: sl@0: /** Gets the subject policy. sl@0: * sl@0: * @return The subject policy. */ sl@0: IMPORT_C TPtrC SubjectPolicy() const; sl@0: private: sl@0: CX509PolicyMapping(); sl@0: void ConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: void ConstructL(const CX509PolicyMapping& aMapping); sl@0: HBufC* iIssuerPolicy; sl@0: HBufC* iSubjectPolicy; sl@0: }; sl@0: sl@0: class CX509PolicyMappingExt : public CX509ExtensionBase sl@0: /** An X.509 certificate extension that contains a set of policy mappings. sl@0: * sl@0: * A policy mapping allows a Certification Authority to declare that two certificate sl@0: * policies are equivalent. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** Creates a new CX509PolicyMappingExt object from the specified buffer containing sl@0: * the binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509PolicyMappingExt object. */ sl@0: IMPORT_C static CX509PolicyMappingExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509PolicyMappingExt object from the specified buffer containing sl@0: * the binary coded representation, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509PolicyMappingExt object. */ sl@0: IMPORT_C static CX509PolicyMappingExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509PolicyMappingExt object from the specified buffer containing sl@0: * the binary coded representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509PolicyMappingExt object. */ sl@0: IMPORT_C static CX509PolicyMappingExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509PolicyMappingExt object from the specified buffer containing sl@0: * the binary coded representation, starting at the specified offset, and puts sl@0: * a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509PolicyMappingExt object. */ sl@0: IMPORT_C static CX509PolicyMappingExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object, prior to its destruction. */ sl@0: virtual ~CX509PolicyMappingExt(); sl@0: sl@0: /** Gets a reference to the array of policy mappings. sl@0: * sl@0: * @return The array of policy mappings. */ sl@0: IMPORT_C const CArrayPtrFlat<CX509PolicyMapping>& Mappings() const; sl@0: private: sl@0: CX509PolicyMappingExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: CArrayPtrFlat<CX509PolicyMapping>* iPolicies; sl@0: }; sl@0: sl@0: //8) authority key ID sl@0: sl@0: class CX509AuthorityKeyIdExt : public CX509ExtensionBase sl@0: /** An X.509 certificate extension that provides a way to find the public key corresponding sl@0: * to the private key used to sign the certificate. sl@0: * sl@0: * This is referred to as the authority key ID extension. sl@0: * sl@0: * The key may be identified by the issuer's name and the issuing certificate's sl@0: * serial number, or by a key identifier value either derived from the public sl@0: * key or by some method of generating unique IDs. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** Creates a new CX509AuthorityKeyIdExt object from the specified buffer containing sl@0: * the binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509AuthorityKeyIdExt object. */ sl@0: IMPORT_C static CX509AuthorityKeyIdExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509AuthorityKeyIdExt object from the specified buffer containing sl@0: * the binary coded representation, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509AuthorityKeyIdExt object. */ sl@0: IMPORT_C static CX509AuthorityKeyIdExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509AuthorityKeyIdExt object from the specified buffer containing sl@0: * the binary coded representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509AuthorityKeyIdExt object. */ sl@0: IMPORT_C static CX509AuthorityKeyIdExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509AuthorityKeyIdExt object from the specified buffer containing sl@0: * the binary coded representation, starting at the specified offset, and puts sl@0: * a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509AuthorityKeyIdExt object. */ sl@0: IMPORT_C static CX509AuthorityKeyIdExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object, prior to its destruction. */ sl@0: virtual ~CX509AuthorityKeyIdExt(); sl@0: sl@0: /** Gets the authority name. sl@0: * sl@0: * @return The authority name. */ sl@0: IMPORT_C const CArrayPtrFlat<CX509GeneralName>& AuthorityName() const; sl@0: sl@0: /** Gets the authority certificate serial number. sl@0: * sl@0: * @return A pointer descriptor representing the authority certificate serial number. */ sl@0: IMPORT_C TPtrC8 AuthorityCertSerialNumber() const; sl@0: sl@0: /** Gets the key identifier value. sl@0: * sl@0: * @return A pointer descriptor representing the key identifier value. */ sl@0: IMPORT_C TPtrC8 KeyId() const; sl@0: private: sl@0: CX509AuthorityKeyIdExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: void DecodeNameL(const TDesC8& aBinaryData); sl@0: void DecodeSerialNoL(const TDesC8& aBinaryData); sl@0: void DecodeKeyIdL(const TDesC8& aBinaryData); sl@0: CArrayPtrFlat<CX509GeneralName>* iAuthorityName; sl@0: HBufC8* iAuthorityCertSerialNumber; sl@0: HBufC8* iKeyIdentifier; sl@0: }; sl@0: sl@0: //9) subject key ID sl@0: sl@0: class CX509SubjectKeyIdExt : public CX509ExtensionBase sl@0: /** An X.509 certificate extension that provides a way of identifying certificates sl@0: * that contain a specific public key. sl@0: * sl@0: * This is referred to as the subject key ID extension. sl@0: * sl@0: * It consists of a key identifier value either derived from the public key or sl@0: * by some method of generating unique IDs. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** Creates a new CX509SubjectKeyIdExt object from the specified buffer containing sl@0: * the binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509SubjectKeyIdExt object. */ sl@0: IMPORT_C static CX509SubjectKeyIdExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509SubjectKeyIdExt object from the specified buffer containing sl@0: * the binary coded representation, and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509SubjectKeyIdExt object. */ sl@0: IMPORT_C static CX509SubjectKeyIdExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509SubjectKeyIdExt object from the specified buffer containing sl@0: * the binary coded representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509SubjectKeyIdExt object. */ sl@0: IMPORT_C static CX509SubjectKeyIdExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509SubjectKeyIdExt object from the specified buffer containing sl@0: * the binary coded representation, starting at the specified offset, and puts sl@0: * a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509SubjectKeyIdExt object. */ sl@0: IMPORT_C static CX509SubjectKeyIdExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object, prior to its destruction. */ sl@0: IMPORT_C ~CX509SubjectKeyIdExt(); sl@0: sl@0: /** Gets the key ID. sl@0: * sl@0: * @return A pointer descriptor representing the key ID. */ sl@0: IMPORT_C TPtrC8 KeyId() const; sl@0: private: sl@0: CX509SubjectKeyIdExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: HBufC8* iKeyIdentifier; sl@0: }; sl@0: sl@0: //10) extended key usage sl@0: sl@0: class CX509ExtendedKeyUsageExt : public CX509ExtensionBase sl@0: /** An X.509 certificate extension that defines the extra uses to which a key may be put. sl@0: * sl@0: * This is referred to as the extended key usage extension. sl@0: * sl@0: * @since v6.0 */ sl@0: { sl@0: public: sl@0: /** Creates a new CX509ExtendedKeyUsageExt object from the specified buffer sl@0: * containing the binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary data. sl@0: * @return The new CX509ExtendedKeyUsageExt object. */ sl@0: IMPORT_C static CX509ExtendedKeyUsageExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509ExtendedKeyUsageExt object from the specified buffer sl@0: * containing the binary coded representation, and puts a pointer to it onto sl@0: * the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509ExtendedKeyUsageExt object. */ sl@0: IMPORT_C static CX509ExtendedKeyUsageExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509ExtendedKeyUsageExt object from the specified buffer sl@0: * containing the binary coded representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509ExtendedKeyUsageExt object. */ sl@0: IMPORT_C static CX509ExtendedKeyUsageExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509ExtendedKeyUsageExt object from the specified buffer sl@0: * containing the binary coded representation, starting at the specified offset, sl@0: * and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509ExtendedKeyUsageExt object. */ sl@0: IMPORT_C static CX509ExtendedKeyUsageExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. sl@0: * sl@0: * Frees all resources owned by the object, prior to its destruction. */ sl@0: IMPORT_C ~CX509ExtendedKeyUsageExt(); sl@0: sl@0: /** Gets the sequence of Object Ids (OID) that identify the key usages. sl@0: * sl@0: * The sequence is held in a set of heap descriptors. sl@0: * sl@0: * @return A reference to the array of pointers to the heap descriptors that sl@0: * contain the OIDs. */ sl@0: IMPORT_C const CArrayPtrFlat<HBufC>& KeyUsages() const; sl@0: private: sl@0: CX509ExtendedKeyUsageExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: CArrayPtrFlat<HBufC>* iKeyUsages; sl@0: }; sl@0: sl@0: //11) authority information access sl@0: sl@0: class CX509AccessDescription : public CBase sl@0: /** This class provides the access method OID and access location as used by X.509 private internet extensions sl@0: * (authority information access). sl@0: * sl@0: */ sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509AccessDescription object from the specified buffer sl@0: * containing the binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary data. sl@0: * @return The new CX509AccessDescription object. sl@0: **/ sl@0: static CX509AccessDescription* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509AccessDescription object from the specified buffer sl@0: * containing the binary coded representation, and puts a pointer to it onto sl@0: * the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509AccessDescription object. sl@0: **/ sl@0: static CX509AccessDescription* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509AuthInfoAccessExt object from the specified buffer sl@0: * containing the binary coded representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509AuthInfoAccessExt object. sl@0: **/ sl@0: static CX509AccessDescription* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** sl@0: * @internalComponent sl@0: * sl@0: * Creates a new CX509AccessDescription object from the specified buffer sl@0: * containing the binary coded representation, starting at the specified offset, sl@0: * and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509AccessDescription object. sl@0: **/ sl@0: static CX509AccessDescription* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. Frees all resources owned by the object, prior to its destruction. sl@0: */ sl@0: virtual ~CX509AccessDescription(); sl@0: sl@0: /** Gets the Access Method OID. sl@0: * sl@0: * @return A non modifiable pointer descriptor to point to the access method OID. sl@0: */ sl@0: IMPORT_C TPtrC Method() const; sl@0: sl@0: /** Gets the Access Location field which specifies the location where the additional sl@0: * information of the CA can be obtained. sl@0: * sl@0: * @return A reference to access location . sl@0: */ sl@0: IMPORT_C const CX509GeneralName& Location() const; sl@0: private: sl@0: CX509AccessDescription(); sl@0: void ConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: HBufC* iMethodId; sl@0: CX509GeneralName* iLocation; sl@0: }; sl@0: sl@0: class CX509AuthInfoAccessExt : public CX509ExtensionBase sl@0: /** An X.509 certificate extension that defines the authority information access. sl@0: * sl@0: * sl@0: */ sl@0: sl@0: { sl@0: public: sl@0: sl@0: /** Creates a new CX509AuthInfoAccessExt object from the specified buffer sl@0: * containing the binary coded representation. sl@0: * sl@0: * @param aBinaryData The encoded binary data. sl@0: * @return The new CX509AuthInfoAccessExt object. sl@0: */ sl@0: IMPORT_C static CX509AuthInfoAccessExt* NewL(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509AuthInfoAccessExt object from the specified buffer sl@0: * containing the binary coded representation, and puts a pointer to it onto sl@0: * the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @return The new CX509AuthInfoAccessExt object. sl@0: */ sl@0: IMPORT_C static CX509AuthInfoAccessExt* NewLC(const TDesC8& aBinaryData); sl@0: sl@0: /** Creates a new CX509AuthInfoAccessExt object from the specified buffer sl@0: * containing the binary coded representation, starting at the specified offset. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509AuthInfoAccessExt object. sl@0: */ sl@0: IMPORT_C static CX509AuthInfoAccessExt* NewL(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Creates a new CX509AuthInfoAccessExt object from the specified buffer sl@0: * containing the binary coded representation, starting at the specified offset, sl@0: * and puts a pointer to it onto the cleanup stack. sl@0: * sl@0: * @param aBinaryData The encoded binary representation. sl@0: * @param aPos The offset position from which to start decoding. sl@0: * @return The new CX509AuthInfoAccessExt object. sl@0: */ sl@0: IMPORT_C static CX509AuthInfoAccessExt* NewLC(const TDesC8& aBinaryData, TInt& aPos); sl@0: sl@0: /** Destructor. Frees all resources owned by the object, prior to its destruction. sl@0: */ sl@0: IMPORT_C ~CX509AuthInfoAccessExt(); sl@0: sl@0: /** Gets the authority access description containing the method and location of additional information of CA , sl@0: * who issued the certificate in which this extension appears. sl@0: * sl@0: * @return A reference to the array of pointers to the authority access descriptions. sl@0: */ sl@0: IMPORT_C const CArrayPtrFlat<CX509AccessDescription>& AccessDescriptions() const; sl@0: private: sl@0: CX509AuthInfoAccessExt(); sl@0: void DoConstructL(const TDesC8& aBinaryData, TInt& aPos); sl@0: CArrayPtrFlat<CX509AccessDescription>* iAccessDescs; sl@0: }; sl@0: sl@0: #endif