CX509Certificate Class Reference

class CX509Certificate : public CCertificate

An X.509 certificate.

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.

The encoded data for the specified data element of the signed object.

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).

The certificate extension: Note that ownership is not transferred to the caller.

Parameters

const TDesC & aExtensionNameThe OID identifying the extension.

Extensions()

IMPORT_C const CArrayPtrFlat< CX509CertExtension > &Extensions()const

Gets all generic certificate extensions.

The 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.

ETrue, if the certificates are equal;EFalse, otherwise.

Parameters

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

IsSelfSignedL()

IMPORT_C TBoolIsSelfSignedL()const [virtual]

Tests whether the certificate is self-signed.

ETrue, if it is self-signed; EFalse, otherwise.

IssuerL()

IMPORT_C HBufC *IssuerL()const [virtual]

Gets the issuer of the certificate.

A heap descriptor representing the issuer of the certificate.

IssuerName()

IMPORT_C const CX500DistinguishedName &IssuerName()const

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

The X.500 Distinguished Name that identifies the issuer.

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.

A unique key identifier for the certificate.

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.

The new X.509 certificate object.

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.

The new X.509 certificate object.

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.

The new X.509 certificate object.

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.

The new X.509 certificate object.

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.

The new X.509 certificate object.

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.

The new X.509 certificate object.

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.

The new X.509 certificate object.

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.

The new X.509 certificate object.

Parameters

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

SignedDataL()

IMPORT_C const TPtrC8SignedDataL()const [virtual]

Gets the certificate's signed data.

A non-modifiable pointer descriptor representing the certificate's signed data.

SubjectKeyIdL()

IMPORT_C TKeyIdentifierSubjectKeyIdL()

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. The subject key identifier for the certificate.

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.

The subject key identifier for the certificate.

SubjectL()

IMPORT_C HBufC *SubjectL()const [virtual]

Gets the subject of the certificate.

A heap descriptor representing the issuer of the certificate.

SubjectName()

IMPORT_C const CX500DistinguishedName &SubjectName()const

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

The X.500 Distinguished Name that identifies the subject.

Version()

IMPORT_C TIntVersion()const

Gets the version number of the certificate.

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]