CX509Certificate Class Reference

class CX509Certificate : public CCertificate

An X.509 certificate.

Since
v6.0

Inherits from

Public Member Functions
~CX509Certificate()
IMPORT_C const TPtrC8 *DataElementEncoding(const TUint)
IMPORT_C const CX509CertExtension *Extension(const TDesC &)
IMPORT_C const CArrayPtrFlat< CX509CertExtension > &Extensions()
IMPORT_C voidInternalizeL(RReadStream &)
IMPORT_C TBoolIsEqualL(const CX509Certificate &)
IMPORT_C TBoolIsSelfSignedL()
IMPORT_C HBufC *IssuerL()
IMPORT_C const CX500DistinguishedName &IssuerName()
IMPORT_C TKeyIdentifierKeyIdentifierL()
IMPORT_C CX509Certificate *NewL(const TDesC8 &)
IMPORT_C CX509Certificate *NewL(const TDesC8 &, TInt &)
IMPORT_C CX509Certificate *NewL(RReadStream &)
IMPORT_C CX509Certificate *NewL(const CX509Certificate &)
IMPORT_C CX509Certificate *NewLC(const TDesC8 &)
IMPORT_C CX509Certificate *NewLC(const TDesC8 &, TInt &)
IMPORT_C CX509Certificate *NewLC(RReadStream &)
IMPORT_C CX509Certificate *NewLC(const CX509Certificate &)
IMPORT_C const TPtrC8SignedDataL()
IMPORT_C TKeyIdentifierSubjectKeyIdL()
IMPORT_C TKeyIdentifierSubjectKeyIdentifierL()
IMPORT_C HBufC *SubjectL()
IMPORT_C const CX500DistinguishedName &SubjectName()
IMPORT_C TIntVersion()
Private Member Functions
CX509Certificate()
voidConstructCertL()
voidConstructL(const TDesC8 &, TInt &)
voidConstructL(const CX509Certificate &)
voidDecodeExtsL(const TDesC8 &, TBool &)
HBufC8 *DecodeUidL(const TDesC8 &, TBool &)
voidInitDataElementsL(const CX509Certificate &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CCertificate::PublicKey()const
CCertificate::SerialNumber()const
CCertificate::ValidityPeriod()const
CCertificate::~CCertificate()
CSignedObject::Encoding()const
CSignedObject::ExternalizeL(RWriteStream &)const
CSignedObject::Fingerprint()const
CSignedObject::SetParametersL(const CSigningKeyParameters &)
CSignedObject::Signature()const
CSignedObject::SigningAlgorithm()const
CSignedObject::VerifyRSASignatureL(const TDesC8 &)const
CSignedObject::VerifyRSASignatureL(const TDesC8 &,const TDesC8 &)const
CSignedObject::VerifySignatureL(const TDesC8 &)const
CSignedObject::VerifySignatureL(const TDesC8 &,const TDesC8 &)const
CSignedObject::~CSignedObject()
Public Member Enumerations
enumanonymous {
EVersionNumber = 0, ESerialNumber = 1, EAlgorithmId = 2, EIssuerName = 3, EValidityPeriod = 4, ESubjectName = 5, ESubjectPublicKeyInfo = 6, EIssuerUID = 7, ESubjectUID = 8, EExtensionList = 9
}
Private Attributes
TFixedArray< TPtrC8 *, KX509MaxDataElements > *iDataElements
CArrayPtrFlat< CX509CertExtension > *iExtensions
CX500DistinguishedName *iIssuerName
HBufC8 *iIssuerUid
CX500DistinguishedName *iSubjectName
HBufC8 *iSubjectUid
TInt iVersion
Inherited Attributes
CCertificate::iSerialNumber
CCertificate::iSubjectPublicKeyInfo
CCertificate::iValidityPeriod
CSignedObject::iEncoding
CSignedObject::iFingerprint
CSignedObject::iKeyFactory
CSignedObject::iParameters
CSignedObject::iSignature
CSignedObject::iSigningAlgorithm

Constructor & Destructor Documentation

CX509Certificate()

CX509Certificate()[private]

~CX509Certificate()

IMPORT_C~CX509Certificate()

Destructor.

Frees all resources owned by the object, prior to its destruction.

Member Functions Documentation

ConstructCertL()

voidConstructCertL()[private]

ConstructL(const TDesC8 &, TInt &)

voidConstructL(const TDesC8 &aBinaryData,
TInt &aPos
)[private]

Parameters

const TDesC8 & aBinaryData
TInt & aPos

ConstructL(const CX509Certificate &)

voidConstructL(const CX509Certificate &aCertificate)[private]

Parameters

const CX509Certificate & aCertificate

DataElementEncoding(const TUint)

IMPORT_C const TPtrC8 *DataElementEncoding(const TUintaIndex)const [virtual]

Gets the encoded data for the specified encoded data element (in the To Be Signed (TBS) certificate data structure) of the signed object.

Since
v7.0

Parameters

const TUint aIndexThe encoded data element position in the TBSCertificate data structure. (See the CX509Certificate enumeration.)

DecodeExtsL(const TDesC8 &, TBool &)

voidDecodeExtsL(const TDesC8 &aBinaryData,
TBool &aHasElementAlready
)[private]

Parameters

const TDesC8 & aBinaryData
TBool & aHasElementAlready

DecodeUidL(const TDesC8 &, TBool &)

HBufC8 *DecodeUidL(const TDesC8 &aBinaryData,
TBool &aHasElementAlready
)[private]

Parameters

const TDesC8 & aBinaryData
TBool & aHasElementAlready

Extension(const TDesC &)

IMPORT_C const CX509CertExtension *Extension(const TDesC &aExtensionName)const

Gets the certificate extension identified by the specified object identifier (OID).

Parameters

const TDesC & aExtensionNameThe OID identifying the extension.

Extensions()

IMPORT_C const CArrayPtrFlat< CX509CertExtension > &Extensions()const

Gets all generic certificate extensions.

InitDataElementsL(const CX509Certificate &)

voidInitDataElementsL(const CX509Certificate &aCertificate)[private]

Parameters

const CX509Certificate & aCertificate

InternalizeL(RReadStream &)

IMPORT_C voidInternalizeL(RReadStream &aStream)[virtual]

Internalises an object of this class from a read stream.

The presence of this function means that the standard templated operator>>() can be used to internalise objects of this class.

Note that the function has assignment semantics. It replaces the old value of the object with a new value read from the read stream.

Parameters

RReadStream & aStreamStream from which the object is to be internalised.

IsEqualL(const CX509Certificate &)

IMPORT_C TBoolIsEqualL(const CX509Certificate &aCert)const

Tests whether the specified X.509 certificate is equal to this X.509 certificate.

X.509 certificates are equal if both the serial number and the issuer name are the same.

Parameters

const CX509Certificate & aCertThe X.509 certificate to be compared.

IsSelfSignedL()

IMPORT_C TBoolIsSelfSignedL()const [virtual]

Tests whether the certificate is self-signed.

IssuerL()

IMPORT_C HBufC *IssuerL()const [virtual]

Gets the issuer of the certificate.

If the certificate has decoded the members from TeletexString then the return value may be incorrect because TeletexString type is not fully supported by this library. Instead the decode methods perform a direct conversion from 8 to 16bits by adding null characters in the second byte of each character. This will work as expected for cases where the string contains ASCII data.

IssuerName()

IMPORT_C const CX500DistinguishedName &IssuerName()const

Gets the X.500 Distinguished Name that identifies the issuer.

If the certificate has decoded the members from TeletexString then the return value may be incorrect because TeletexString type is not fully supported by this library. Instead the decode methods perform a direct conversion from 8 to 16bits by adding null characters in the second byte of each character. This will work as expected for cases where the string contains ASCII data.

KeyIdentifierL()

IMPORT_C TKeyIdentifierKeyIdentifierL()const [virtual]

Gets a key identifier for the certificate. This is a unique identifier, calculated according to the recommended method of computing it from RFC3280, section 4.2.1.2. Please note that this method does NOT return the value of the Subject Key Id extension, if it is present.

NewL(const TDesC8 &)

IMPORT_C CX509Certificate *NewL(const TDesC8 &aBinaryData)[static]

Creates a new X.509 certificate object from the specified buffer containing the binary coded representation.

Parameters

const TDesC8 & aBinaryDataThe encoded binary representation.

NewL(const TDesC8 &, TInt &)

IMPORT_C CX509Certificate *NewL(const TDesC8 &aBinaryData,
TInt &aPos
)[static]

Creates a new X.509 certificate object from the specified buffer containing the binary coded representation, starting at the specified offset.

Parameters

const TDesC8 & aBinaryDataThe encoded binary representation.
TInt & aPosThe offset position from which to start decoding.

NewL(RReadStream &)

IMPORT_C CX509Certificate *NewL(RReadStream &aStream)[static]

Creates a new X.509 certificate object from the specified read stream.

Parameters

RReadStream & aStreamStream from which the contents should be internalised.

NewL(const CX509Certificate &)

IMPORT_C CX509Certificate *NewL(const CX509Certificate &aCert)[static]

Creates a new X.509 certificate object from an existing object.

This is equivalent to a copy constructor.

Parameters

const CX509Certificate & aCertThe X.509 certificate to be copied.

NewLC(const TDesC8 &)

IMPORT_C CX509Certificate *NewLC(const TDesC8 &aBinaryData)[static]

Creates a new X.509 certificate object from the specified buffer containing the binary coded representation, and puts a pointer to it onto the cleanup stack.

Initialises the object from its encoded binary form into an internal representation.

Parameters

const TDesC8 & aBinaryDataThe encoded binary representation.

NewLC(const TDesC8 &, TInt &)

IMPORT_C CX509Certificate *NewLC(const TDesC8 &aBinaryData,
TInt &aPos
)[static]

Creates a new X.509 certificate object from the specified buffer containing the binary coded representation, starting at the specified offset, and puts a pointer to it onto the cleanup stack.

Parameters

const TDesC8 & aBinaryDataThe encoded binary representation.
TInt & aPosThe offset position from which to start decoding.

NewLC(RReadStream &)

IMPORT_C CX509Certificate *NewLC(RReadStream &aStream)[static]

Creates a new X.509 certificate object from the specified read stream, and puts a pointer to it onto the cleanup stack.

Construction is from the stream.

Parameters

RReadStream & aStreamStream from which the contents should be internalised.

NewLC(const CX509Certificate &)

IMPORT_C CX509Certificate *NewLC(const CX509Certificate &aCert)[static]

Creates a new X.509 certificate object from an existing object.

This is equivalent to a copy constructor.

Parameters

const CX509Certificate & aCertThe X.509 certificate to be copied.

SignedDataL()

IMPORT_C const TPtrC8SignedDataL()const [virtual]

Gets the certificate's signed data.

SubjectKeyIdL()

IMPORT_C TKeyIdentifierSubjectKeyIdL()const

Retrieves the subject key identifier of a certificate based on the decision whether it is a CA certificate or not. If it is a CA certificate then returns the stored subject key id as an extension in the certificate, any other certificate it returns the keyidentifier as calculated by Symbian's proprietary logic.

SubjectKeyIdentifierL()

IMPORT_C TKeyIdentifierSubjectKeyIdentifierL()const

Gets the subject key identifier for the certificate. This identifier is extracted from the certificate (if the corresponding extension exists), or calculated (if the extension doesn't exist). If calculated, the recommendation from section 4.2.1.2, RFC3280 is used (hash of the public key). Please note, that for subject key ids extracted from the certificate there is a length limit - if the extension is longer than 160 bits, it is ignored and the value is calculated instead.

SubjectL()

IMPORT_C HBufC *SubjectL()const [virtual]

Gets the subject of the certificate.

If the certificate has decoded the members from TeletexString then the return value may be incorrect because TeletexString type is not fully supported by this library. Instead the decode methods perform a direct conversion from 8 to 16bits by adding null characters in the second byte of each character. This will work as expected for cases where the string contains ASCII data.

SubjectName()

IMPORT_C const CX500DistinguishedName &SubjectName()const

Gets the X.500 Distinguished Name that identifies the subject.

If the certificate has decoded the members from TeletexString then the return value may be incorrect because TeletexString type is not fully supported by this library. Instead the decode methods perform a direct conversion from 8 to 16bits by adding null characters in the second byte of each character. This will work as expected for cases where the string contains ASCII data.

Version()

IMPORT_C TIntVersion()const

Gets the version number of the certificate.

Member Enumerations Documentation

Enum anonymous

Enumerates values for encoded data element positions in the TBSCertificate data structure.

These values are to be used as parameters to the DataElementEncoding() function.

Enumerators

EVersionNumber = 0
ESerialNumber = 1
EAlgorithmId = 2
EIssuerName = 3
EValidityPeriod = 4
ESubjectName = 5
ESubjectPublicKeyInfo = 6
EIssuerUID = 7
ESubjectUID = 8
EExtensionList = 9

Member Data Documentation

TFixedArray< TPtrC8 *, KX509MaxDataElements > * iDataElements

TFixedArray< TPtrC8 *, KX509MaxDataElements > *iDataElements[private]

CArrayPtrFlat< CX509CertExtension > * iExtensions

CArrayPtrFlat< CX509CertExtension > *iExtensions[private]

CX500DistinguishedName * iIssuerName

CX500DistinguishedName *iIssuerName[private]

HBufC8 * iIssuerUid

HBufC8 *iIssuerUid[private]

CX500DistinguishedName * iSubjectName

CX500DistinguishedName *iSubjectName[private]

HBufC8 * iSubjectUid

HBufC8 *iSubjectUid[private]

TInt iVersion

TInt iVersion[private]