Class KJUR.asn1.ASN1Util
ASN1 utilities class
Defined in: asn1-1.0.js.
Constructor Attributes | Constructor Name and Description |
---|---|
ASN1 utilities class
|
Method Attributes | Method Name and Description |
---|---|
<static> |
KJUR.asn1.ASN1Util.getPEMStringFromHex(dataHex, pemHeader)
get PEM string from hexadecimal data and header string
This method converts a hexadecimal string to a PEM string with
a specified header.
|
<static> |
KJUR.asn1.ASN1Util.jsonToASN1HEX(param)
get encoded hexadecimal string of ASN1Object specifed by JSON parameters
As for ASN.1 object representation of JSON object,
please see newObject.
|
<static> |
KJUR.asn1.ASN1Util.newObject(param)
generate ASN1Object specifed by JSON parameters
generate any ASN1Object specified by JSON param
including ASN.1 primitive or structured.
|
<static> |
KJUR.asn1.ASN1Util.oidHexToInt(hex)
get dot noted oid number string from hexadecimal value of OID
This static method converts from hexadecimal string representation of
ASN.1 value of object identifier to oid number string.
|
<static> |
KJUR.asn1.ASN1Util.oidIntToHex(oidString)
get hexadecimal value of object identifier from dot noted oid value (DEPRECATED)
This static method converts from object identifier value string.
|
Method Detail
<static>
{String}
KJUR.asn1.ASN1Util.getPEMStringFromHex(dataHex, pemHeader)
get PEM string from hexadecimal data and header string
This method converts a hexadecimal string to a PEM string with
a specified header. Its line break will be CRLF("\r\n").
var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY'); // value of pem will be: -----BEGIN PRIVATE KEY----- YWFh -----END PRIVATE KEY-----
- Parameters:
- {String} dataHex
- hexadecimal string of PEM body
- {String} pemHeader
- PEM header string (ex. 'RSA PRIVATE KEY')
- Returns:
- {String} PEM formatted string of input data
<static>
KJUR.asn1.ASN1Util.jsonToASN1HEX(param)
get encoded hexadecimal string of ASN1Object specifed by JSON parameters
As for ASN.1 object representation of JSON object,
please see newObject.
jsonToASN1HEX({'prnstr': 'aaa'});
- Parameters:
- {Array} param
- JSON parameter to generate ASN1Object
- Since:
- asn1 1.0.4
- Returns:
- hexadecimal string of ASN1Object
<static>
{KJUR.asn1.ASN1Object}
KJUR.asn1.ASN1Util.newObject(param)
generate ASN1Object specifed by JSON parameters
generate any ASN1Object specified by JSON param
including ASN.1 primitive or structured.
Generally 'param' can be described as follows:
NOTE: Structured object such as SEQUENCE or SET can conclude ASN1Object as well as JSON parameters since jsrsasign 9.0.0.
{TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER}'TYPE-OF-ASN1OBJ' can be one of following symbols:
- 'bool' - KJUR.asn1.DERBoolean
- 'int' - KJUR.asn1.DERInteger
- 'bitstr' - KJUR.asn1.DERBitString
- 'octstr' - KJUR.asn1.DEROctetString
- 'null' - KJUR.asn1.DERNull
- 'oid' - KJUR.asn1.DERObjectIdentifier
- 'enum' - KJUR.asn1.DEREnumerated
- 'utf8str' - KJUR.asn1.DERUTF8String
- 'numstr' - KJUR.asn1.DERNumericString
- 'prnstr' - KJUR.asn1.DERPrintableString
- 'telstr' - KJUR.asn1.DERTeletexString
- 'ia5str' - KJUR.asn1.DERIA5String
- 'utctime' - KJUR.asn1.DERUTCTime
- 'gentime' - KJUR.asn1.DERGeneralizedTime
- 'visstr' - KJUR.asn1.DERVisibleString
- 'bmpstr' - KJUR.asn1.DERBMPString
- 'seq' - KJUR.asn1.DERSequence
- 'set' - KJUR.asn1.DERSet
- 'tag' - KJUR.asn1.DERTaggedObject
- 'asn1' - KJUR.asn1.ASN1Object
NOTE: Structured object such as SEQUENCE or SET can conclude ASN1Object as well as JSON parameters since jsrsasign 9.0.0.
newObject({'prnstr': 'aaa'}); newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]}) newObject({seq: [{int: 3}, new DERInteger({int: 3})]}) // mixed // ASN.1 Tagged Object newObject({'tag': {'tag': 'a1', 'explicit': true, 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}}); // more simple representation of ASN.1 Tagged Object newObject({'tag': ['a1', true, {'seq': [ {'int': 3}, {'prnstr': 'aaa'}]} ]});
- Parameters:
- {Array} param
- JSON parameter to generate ASN1Object
- Since:
- asn1 1.0.3
- Returns:
- {KJUR.asn1.ASN1Object} generated object
<static>
{String}
KJUR.asn1.ASN1Util.oidHexToInt(hex)
get dot noted oid number string from hexadecimal value of OID
This static method converts from hexadecimal string representation of
ASN.1 value of object identifier to oid number string.
KJUR.asn1.ASN1Util.oidHexToInt('550406') → "2.5.4.6"
- Parameters:
- {String} hex
- hexadecimal value of object identifier
- Since:
- jsrsasign 4.8.3 asn1 1.0.7
- Returns:
- {String} dot noted string of object identifier
<static>
{String}
KJUR.asn1.ASN1Util.oidIntToHex(oidString)
get hexadecimal value of object identifier from dot noted oid value (DEPRECATED)
This static method converts from object identifier value string.
to hexadecimal string representation of it.
ASN1HEX.hextooidstr is a reverse function of this.
KJUR.asn1.ASN1Util.oidIntToHex("2.5.4.6") → "550406"
- Parameters:
- {String} oidString
- dot noted string of object identifier
- Deprecated:
- from jsrsasign 10.0.6. please use oidtohex
- Since:
- jsrsasign 4.8.3 asn1 1.0.7
- Returns:
- {String} hexadecimal value of object identifier
- See: