Skip to main content

Name

UTF-8 String Representation of Distinguished Names

https://tools.ietf.org/html/rfc2253

Constructors​

Constructor​

new Name(data, extraNames): Name

Creates a new instance

Parameters​

data​

any

extraNames​

IdOrName = {}

Extra identifiers for name customization

Returns​

Name

Example​

const text = "URL=http://some.url.com, IP=192.168.0.1, GUID={8ee13e53-2c1c-42bb-8df7-39927c0bdbb6}";
const name = new x509.Name(text, {
"Email": "1.2.3.4.5.1",
"IP": "1.2.3.4.5.2",
"GUID": "1.2.3.4.5.3",
});

Methods​

getField()​

getField(idOrName): string[]

Returns a list of string values filtered by specified id or name

Parameters​

idOrName​

string

ObjectIdentifier or string name

Returns​

string[]

Returns a list of strings. Returns an empty list if there are not any values for specified id/name.


getThumbprint()​

Call Signature​

getThumbprint(crypto?): Promise<ArrayBuffer>

Returns a SHA-1 thumbprint

Parameters​
crypto?​

Crypto

Crypto provider. Default is from CryptoProvider

Returns​

Promise<ArrayBuffer>

Call Signature​

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

Returns a thumbprint for specified mechanism

Parameters​
algorithm​

AlgorithmIdentifier

Hash algorithm

crypto?​

Crypto

Crypto provider. Default is from CryptoProvider

Returns​

Promise<ArrayBuffer>


toArrayBuffer()​

toArrayBuffer(): any

Returns Name in DER encoded format

Returns​

any


toJSON()​

toJSON(): JsonName

Returns a JSON representation of the Name

Returns​

JsonName


toString()​

toString(): any

Returns string serialized Name

Returns​

any


isASCII()​

static isASCII(text): boolean

Returns true if text is ASCII otherwise false

Parameters​

text​

string

Text

Returns​

boolean


isPrintableString()​

static isPrintableString(text): boolean

Checks if a given string is a printable string. A printable string contains only printable ASCII characters.

Parameters​

text​

string

The string to be checked.

Returns​

boolean

True if the string is a printable string, false otherwise.