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