PublicKey
Representation of Subject Public Key Info
Extends
PemData<SubjectPublicKeyInfo>
Constructors
Constructor
new PublicKey(
asn):PublicKey
Creates a new instance from ASN.1
Parameters
asn
SubjectPublicKeyInfo
ASN.1 object
Returns
PublicKey
Overrides
Constructor
new PublicKey(
raw):PublicKey
Creates a new instance
Parameters
raw
Encoded buffer (DER, PEM, HEX, Base64, Base64Url)
Returns
PublicKey
Overrides
Properties
algorithm
algorithm:
Algorithm
Gets a key algorithm
asn
protectedreadonlyasn:SubjectPublicKeyInfo
ASN.1 object
Inherited from
tag
protectedreadonlytag:string
PEM tag
Overrides
NAME
staticNAME:string="ASN"
Inherited from
Accessors
rawData
Get Signature
get rawData():
ArrayBuffer
Gets a DER encoded buffer
Returns
ArrayBuffer
Inherited from
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
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 | EcKeyImportParams | RsaHashedImportParams
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()
protectedgetTextName():string
Returns
string
Inherited from
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()
protectedonInit(asn):void
Occurs on instance initialization
Parameters
asn
SubjectPublicKeyInfo
ASN.1 object
Returns
void
Overrides
toString()
Call Signature
toString():
string
Returns encoded object in PEM format
Returns
string
Inherited from
Call Signature
toString(
format):string
Returns encoded object in selected format
Parameters
format
hex, base64, base64url, pem, asn, text
Returns
string
Inherited from
toTextObject()
toTextObject():
TextObject
Returns the object in textual representation
Returns
Overrides
toTextObjectEmpty()
protectedtoTextObjectEmpty(value?):TextObject
Parameters
value?
string
Returns
Inherited from
create()
staticcreate(data,crypto):Promise<PublicKey>
Creates a new instance from a public key data
Parameters
data
Public key data
crypto
Crypto = ...
Crypto provider. Default is from CryptoProvider
Returns
Promise<PublicKey>
isAsnEncoded()
staticisAsnEncoded(data):data is AsnEncodedType
Parameters
data
any
Returns
data is AsnEncodedType
Inherited from
toArrayBuffer()
statictoArrayBuffer(raw):ArrayBuffer
Converts encoded raw to ArrayBuffer. Supported formats are HEX, DER, Base64, Base64Url, PEM
Parameters
raw
Encoded data
string | BufferSource
Returns
ArrayBuffer