Name
UTF-8 String Representation of Distinguished Names
https://tools.ietf.org/html/rfc2253
Constructors
new Name()
new Name(
data
,extraNames
):Name
Creates a new instance
Parameters
• data: string
| BufferSource
| JsonNameParams
| Name
• extraNames: IdOrName
= {}
Extra identifiers for name customization
Returns
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()
getThumbprint(crypto)
getThumbprint(
crypto
?):Promise
<ArrayBuffer
>
Returns a SHA-1 thumbprint
Parameters
• crypto?: Crypto
Crypto provider. Default is from CryptoProvider
Returns
Promise
<ArrayBuffer
>
getThumbprint(algorithm, crypto)
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():
ArrayBuffer
Returns Name in DER encoded format
Returns
ArrayBuffer
toJSON()
toJSON():
JsonName
Returns a JSON representation of the Name
Returns
toString()
toString():
string
Returns string serialized Name
Returns
string
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.