Skip to main content

X509Certificate

Representation of X509 certificate

Extends

  • PemData<Certificate>

Implements

Constructors

new X509Certificate()

new X509Certificate(asn): X509Certificate

Creates a new instance from ASN.1 Certificate object

Parameters

asn: Certificate

ASN.1 Certificate object

Returns

X509Certificate

Overrides

PemData<Certificate>.constructor

new X509Certificate()

new X509Certificate(raw): X509Certificate

Creates a new instance

Parameters

raw: AsnEncodedType

Encoded buffer (DER, PEM, HEX, Base64, Base64Url)

Returns

X509Certificate

Overrides

PemData<Certificate>.constructor

Properties

extensions

extensions: Extension[]

Gts a list of certificate extensions


issuer

issuer: string

Gets a string issuer name


issuerName

issuerName: Name

Gets the issuer value from the certificate as an Name


notAfter

notAfter: Date

Gets a date after which certificate can't be used


notBefore

notBefore: Date

Gets a date before which certificate can't be used


privateKey?

optional privateKey: CryptoKey

Gets a private key of the certificate


publicKey

publicKey: PublicKey

Gets a public key of the certificate

Implementation of

IPublicKeyContainer.publicKey


rawData

readonly rawData: ArrayBuffer

Gets a DER encoded buffer

Inherited from

PemData.rawData


serialNumber

serialNumber: string

Gets a hexadecimal string of the serial number


signature

signature: ArrayBuffer

Gets a signature


signatureAlgorithm

signatureAlgorithm: HashedAlgorithm

Gets a signature algorithm


subject

subject: string

Gets a string subject name


subjectName

subjectName: Name

Gets the subject value from the certificate as an Name


tag

protected readonly tag: string

PEM tag

Overrides

PemData.tag


NAME

static NAME: string = "Certificate"

Overrides

PemData.NAME

Methods

equal()

equal(data): data is X509Certificate

Returns true if ASN.1 data is equal to another ASN.1 data, otherwise false

Parameters

data: any

Any data

Returns

data is X509Certificate

Inherited from

PemData.equal


getExtension()

getExtension(type)

getExtension<T>(type): null | T

Returns an extension of specified type

Type Parameters

T extends Extension

Parameters

type: string

Extension identifier

Returns

null | T

Extension or null

getExtension(type)

getExtension<T>(type): null | T

Returns an extension of specified type

Type Parameters

T extends Extension

Parameters

type

Extension type

Returns

null | T

Extension or null


getExtensions()

Returns a list of extensions of specified type

Param

Extension identifier

getExtensions(type)

getExtensions<T>(type): T[]

Returns a list of extensions of specified type

Type Parameters

T extends Extension

Parameters

type: string

Extension identifier

Returns

T[]

Param

Extension identifier

getExtensions(type)

getExtensions<T>(type): T[]

Returns a list of extensions of specified type

Type Parameters

T extends Extension

Parameters

type

Extension type

Returns

T[]

Param

Extension identifier


getTextName()

protected getTextName(): string

Returns

string

Inherited from

PemData.getTextName


getThumbprint()

getThumbprint(crypto)

getThumbprint(crypto?): Promise<ArrayBuffer>

Returns a SHA-1 certificate thumbprint

Parameters

crypto?: Crypto

Crypto provider. Default is from CryptoProvider

Returns

Promise<ArrayBuffer>

getThumbprint(algorithm, crypto)

getThumbprint(algorithm, crypto?): Promise<ArrayBuffer>

Returns a certificate thumbprint for specified mechanism

Parameters

algorithm: AlgorithmIdentifier

Hash algorithm

crypto?: Crypto

Crypto provider. Default is from CryptoProvider

Returns

Promise<ArrayBuffer>


isSelfSigned()

isSelfSigned(crypto): Promise<boolean>

Parameters

crypto: Crypto = ...

Returns

Promise<boolean>


onInit()

protected onInit(asn): void

Occurs on instance initialization

Parameters

asn: Certificate

ASN.1 object

Returns

void

Overrides

PemData.onInit


toString()

toString()

toString(): string

Returns encoded object in PEM format

Returns

string

Inherited from

PemData.toString

toString(format)

toString(format): string

Returns encoded object in selected format

Parameters

format: AsnExportType

hex, base64, base64url, pem, asn, text

Returns

string

Inherited from

PemData.toString


toTextObject()

toTextObject(): TextObject

Returns

TextObject

Overrides

PemData.toTextObject


toTextObjectEmpty()

protected toTextObjectEmpty(value?): TextObject

Parameters

value?: string

Returns

TextObject

Inherited from

PemData.toTextObjectEmpty


verify()

verify(params, crypto): Promise<boolean>

Validates a certificate signature

Parameters

params: X509CertificateVerifyParams = {}

Verification parameters

crypto: Crypto = ...

Crypto provider. Default is from CryptoProvider

Returns

Promise<boolean>


isAsnEncoded()

static isAsnEncoded(data): data is AsnEncodedType

Parameters

data: any

Returns

data is AsnEncodedType

Inherited from

PemData.isAsnEncoded


toArrayBuffer()

static toArrayBuffer(raw): ArrayBuffer

Converts encoded raw to ArrayBuffer. Supported formats are HEX, DER, Base64, Base64Url, PEM

Parameters

raw: string | BufferSource

Encoded data

Returns

ArrayBuffer

Inherited from

PemData.toArrayBuffer