Skip to main content

X509Certificate

Representation of X509 certificate

Extends​

Implements​

Constructors​

Constructor​

new X509Certificate(asn, options?): X509Certificate

Creates a new instance from ASN.1 Certificate object

Parameters​

asn​

Certificate

ASN.1 Certificate object

options?​

any

Optional ASN.1 parse options (e.g. asn1js.fromBER resource limits)

Returns​

X509Certificate

Overrides​

PemData.constructor

Constructor​

new X509Certificate(raw, options?): X509Certificate

Creates a new instance

Parameters​

raw​

AsnEncodedType

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

options?​

any

Optional ASN.1 parse options (e.g. asn1js.fromBER resource limits)

Returns​

X509Certificate

Overrides​

PemData.constructor

Properties​

asn​

protected readonly asn: Certificate

ASN.1 object

Inherited from​

PemData.asn


privateKey?​

optional privateKey: CryptoKey

Gets a private key of the certificate


tag​

protected readonly tag: string

PEM tag

Overrides​

PemData.tag


NAME​

static NAME: string = "Certificate"

Overrides​

PemData.NAME

Accessors​

extensions​

Get Signature​

get extensions(): Extension[]

Gets a list of certificate extensions

Returns​

Extension[]


issuer​

Get Signature​

get issuer(): string

Gets a string issuer name

Returns​

string


issuerName​

Get Signature​

get issuerName(): Name

Gets the issuer value from the certificate as an Name

Returns​

Name


notAfter​

Get Signature​

get notAfter(): Date

Gets a date after which certificate can't be used

Returns​

Date


notBefore​

Get Signature​

get notBefore(): Date

Gets a date before which certificate can't be used

Returns​

Date


parseOptions​

Get Signature​

get protected parseOptions(): any

Gets the ASN.1 parse options the instance was created with

Returns​

any

Inherited from​

PemData.parseOptions


publicKey​

Get Signature​

get publicKey(): PublicKey

Gets a public key of the certificate

Returns​

PublicKey

Implementation of​

IPublicKeyContainer.publicKey


rawData​

Get Signature​

get rawData(): ArrayBuffer

Gets a DER encoded buffer

Returns​

ArrayBuffer

Inherited from​

PemData.rawData


serialNumber​

Get Signature​

get serialNumber(): string

Gets a hexadecimal string of the serial number

Returns​

string


signature​

Get Signature​

get signature(): ArrayBuffer

Gets a signature

Returns​

ArrayBuffer


signatureAlgorithm​

Get Signature​

get signatureAlgorithm(): HashedAlgorithm

Gets a signature algorithm

Returns​

HashedAlgorithm


subject​

Get Signature​

get subject(): string

Gets a string subject name

Returns​

string


subjectName​

Get Signature​

get subjectName(): Name

Gets the subject value from the certificate as an Name

Returns​

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()​

Call Signature​

getExtension<T>(type): T | null

Returns an extension of specified type

Type Parameters​
T​

T extends Extension

Parameters​
type​

string

Extension identifier

Returns​

T | null

Extension or null

Call Signature​

getExtension<T>(type): T | null

Returns an extension of specified type

Type Parameters​
T​

T extends Extension

Parameters​
type​

(raw) => T

Extension type

Returns​

T | null

Extension or null


getExtensions()​

Returns a list of extensions of specified type

Param​

Extension identifier

Call Signature​

getExtensions<T>(type): T[]

Returns a list of extensions of specified type

Type Parameters​
T​

T extends Extension

Parameters​
type​

string

Extension identifier

Returns​

T[]

Call Signature​

getExtensions<T>(type): T[]

Returns a list of extensions of specified type

Type Parameters​
T​

T extends Extension

Parameters​
type​

(raw) => T

Extension type

Returns​

T[]


getTextName()​

protected getTextName(): string

Returns​

string

Inherited from​

PemData.getTextName


getThumbprint()​

Call Signature​

getThumbprint(crypto?): Promise<ArrayBuffer>

Returns a SHA-1 certificate thumbprint

Parameters​
crypto?​

Crypto

Crypto provider. Default is from CryptoProvider

Returns​

Promise<ArrayBuffer>

Call Signature​

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

Returns​

void

Overrides​

PemData.onInit


toString()​

Call Signature​

toString(): string

Returns encoded object in PEM format

Returns​

string

Inherited from​

PemData.toString

Call Signature​

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 the object in textual representation

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​

Encoded data

string | BufferSource

Returns​

ArrayBuffer

Inherited from​

PemData.toArrayBuffer