Skip to main content

PublicKey

Representation of Subject Public Key Info

Extends

  • PemData<SubjectPublicKeyInfo>

Constructors

new PublicKey()

new PublicKey(asn): PublicKey

Creates a new instance from ASN.1

Parameters

asn

SubjectPublicKeyInfo

ASN.1 object

Returns

PublicKey

Overrides

PemData<SubjectPublicKeyInfo>.constructor

new PublicKey()

new PublicKey(raw): PublicKey

Creates a new instance

Parameters

raw

AsnEncodedType

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

Returns

PublicKey

Overrides

PemData<SubjectPublicKeyInfo>.constructor

Properties

algorithm

algorithm: Algorithm

Gets a key algorithm


rawData

readonly rawData: ArrayBuffer

Gets a DER encoded buffer

Inherited from

PemData.rawData


tag

protected readonly tag: string

PEM tag

Overrides

PemData.tag


NAME

static NAME: string = "ASN"

Inherited from

PemData.NAME

Methods

equal()

equal(data): data is PublicKey

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

Parameters

data

any

Any data

Returns

data is PublicKey

Inherited from

PemData.equal


export()

Call Signature

export(crypto?): Promise<CryptoKey>

Returns a public CryptoKey

Parameters
crypto?

Crypto

Crypto provider. Default is from CryptoProvider

Returns

Promise<CryptoKey>

Call Signature

export(algorithm, keyUsages, crypto?): Promise<CryptoKey>

Returns a public CryptoKey with specified parameters

Parameters
algorithm

Algorithm

Algorithm | RsaHashedImportParams | EcKeyImportParams

keyUsages

KeyUsage[]

A list of key usages

crypto?

Crypto

Crypto provider. Default is from CryptoProvider

Returns

Promise<CryptoKey>


getKeyIdentifier()

Call Signature

getKeyIdentifier(crypto?): Promise<ArrayBuffer>

Returns Subject Key Identifier as specified in RFC5280

Parameters
crypto?

Crypto

Crypto provider. Default is from CryptoProvider

Returns

Promise<ArrayBuffer>

Call Signature

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

Returns Subject Key Identifier for specified algorithm

Parameters
algorithm

AlgorithmIdentifier

Hash algorithm

crypto?

Crypto

Crypto provider. Default is from CryptoProvider

Returns

Promise<ArrayBuffer>


getTextName()

protected getTextName(): string

Returns

string

Inherited from

PemData.getTextName


getThumbprint()

Call Signature

getThumbprint(crypto?): Promise<ArrayBuffer>

Returns a SHA-1 public key thumbprint

Parameters
crypto?

Crypto

Crypto provider. Default is from CryptoProvider

Returns

Promise<ArrayBuffer>

Call Signature

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

Returns a public key thumbprint for specified mechanism

Parameters
algorithm

AlgorithmIdentifier

Hash algorithm

crypto?

Crypto

Crypto provider. Default is from CryptoProvider

Returns

Promise<ArrayBuffer>


onInit()

protected onInit(asn): void

Occurs on instance initialization

Parameters

asn

SubjectPublicKeyInfo

ASN.1 object

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

TextObject

Overrides

PemData.toTextObject


toTextObjectEmpty()

protected toTextObjectEmpty(value?): TextObject

Parameters

value?

string

Returns

TextObject

Inherited from

PemData.toTextObjectEmpty


create()

static create(data, crypto): Promise<PublicKey>

Creates a new instance from a public key data

Parameters

data

PublicKeyType

Public key data

crypto

Crypto = ...

Crypto provider. Default is from CryptoProvider

Returns

Promise<PublicKey>


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