Class KJUR.asn1.x509.X500Name
Extends
KJUR.asn1.ASN1Object.
X500Name ASN.1 structure class
Defined in: asn1x509-1.0.js.
Constructor Attributes | Constructor Name and Description |
---|---|
KJUR.asn1.x509.X500Name(params)
X500Name ASN.1 structure class
This class provides DistinguishedName ASN.1 class structure
defined in RFC 2253 section 2.
|
- Fields borrowed from class KJUR.asn1.ASN1Object:
- hL, hT, hTLV, hV, isModified
Method Attributes | Method Name and Description |
---|---|
<static> |
KJUR.asn1.x509.X500Name.ldapToOneline(s)
convert LDAP(RFC 2253) distinguished name format string to OpenSSL oneline format
This static method converts a distinguished name string in LDAP(RFC 2253) format to OpenSSL oneline format. |
<static> |
KJUR.asn1.x509.X500Name.onelineToLDAP(s)
convert OpenSSL oneline distinguished name format string to LDAP(RFC 2253) format
This static method converts a distinguished name string in OpenSSL oneline format to LDAP(RFC 2253) format. |
setByLdapString(dnStr)
set DN by LDAP(RFC 2253) distinguished name string
|
|
setByObject(dnObj)
set DN by associative array
|
|
setByString(dnStr)
set DN by OpenSSL oneline distinguished name string
Sets distinguished name by string. |
- Methods borrowed from class KJUR.asn1.ASN1Object:
- getEncodedHex, getLengthHexFromValue, getValueHex
Class Detail
KJUR.asn1.x509.X500Name(params)
X500Name ASN.1 structure class
This class provides DistinguishedName ASN.1 class structure
defined in RFC 2253 section 2.
For string representation of distinguished name in jsrsasign, OpenSSL oneline format is used. Please see wiki article for it.
NOTE: Multi-valued RDN is supported since jsrsasign 6.2.1 asn1x509 1.0.17.
DistinguishedName ::= RDNSequence RDNSequence ::= SEQUENCE OF RelativeDistinguishedName RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue }
For string representation of distinguished name in jsrsasign, OpenSSL oneline format is used. Please see wiki article for it.
NOTE: Multi-valued RDN is supported since jsrsasign 6.2.1 asn1x509 1.0.17.
// 1. construct with string o = new KJUR.asn1.x509.X500Name({str: "/C=US/O=aaa/OU=bbb/CN=foo@example.com"}); o = new KJUR.asn1.x509.X500Name({str: "/C=US/O=aaa+CN=contact@example.com"}); // multi valued // 2. construct by object o = new KJUR.asn1.x509.X500Name({C: "US", O: "aaa", CN: "http://example.com/"});
- Parameters:
- {Array} params
- associative array of parameters (ex. {'str': '/C=US/O=a'})
Method Detail
<static>
{String}
KJUR.asn1.x509.X500Name.ldapToOneline(s)
convert LDAP(RFC 2253) distinguished name format string to OpenSSL oneline format
This static method converts a distinguished name string in LDAP(RFC 2253) format to OpenSSL oneline format.
This static method converts a distinguished name string in LDAP(RFC 2253) format to OpenSSL oneline format.
KJUR.asn1.x509.X500Name.ldapToOneline('O=test,C=US') → '/C=US/O=test' KJUR.asn1.x509.X500Name.ldapToOneline('O=a\,a,C=US') → '/C=US/O=a,a' KJUR.asn1.x509.X500Name.ldapToOneline('O=a/a,C=US') → '/C=US/O=a\/a'
- Parameters:
- {String} s
- distinguished name string in LDAP(RFC 2253) format (ex. O=test,C=US)
- Since:
- jsrsasign 6.2.2 asn1x509 1.0.18
- Returns:
- {String} distinguished name string in OpenSSL oneline format (ex. /C=US/O=test)
- See:
- jsrsasign wiki: distinguished name string difference between OpenSSL oneline and LDAP(RFC 2253)
<static>
{String}
KJUR.asn1.x509.X500Name.onelineToLDAP(s)
convert OpenSSL oneline distinguished name format string to LDAP(RFC 2253) format
This static method converts a distinguished name string in OpenSSL oneline format to LDAP(RFC 2253) format.
This static method converts a distinguished name string in OpenSSL oneline format to LDAP(RFC 2253) format.
KJUR.asn1.x509.X500Name.onelineToLDAP("/C=US/O=test") → 'O=test,C=US' KJUR.asn1.x509.X500Name.onelineToLDAP("/C=US/O=a,a") → 'O=a\,a,C=US'
- Parameters:
- {String} s
- distinguished name string in OpenSSL oneline format (ex. /C=US/O=test)
- Since:
- jsrsasign 6.2.2 asn1x509 1.0.18
- Returns:
- {String} distinguished name string in LDAP(RFC 2253) format (ex. O=test,C=US)
- See:
- jsrsasign wiki: distinguished name string difference between OpenSSL oneline and LDAP(RFC 2253)
setByLdapString(dnStr)
set DN by LDAP(RFC 2253) distinguished name string
name = new KJUR.asn1.x509.X500Name(); name.setByLdapString("CN=foo@example.com,OU=bbb,O=aaa,C=US");
- Parameters:
- {String} dnStr
- distinguished name by LDAP string (ex. O=aaa,C=US)
- Since:
- jsrsasign 6.2.2 asn1x509 1.0.18
setByObject(dnObj)
set DN by associative array
name = new KJUR.asn1.x509.X500Name(); name.setByObject({C: "US", O: "aaa", CN="http://example.com/"1});
- Parameters:
- {Array} dnObj
- associative array of DN (ex. {C: "US", O: "aaa"})
- Since:
- jsrsasign 4.9. asn1x509 1.0.13
setByString(dnStr)
set DN by OpenSSL oneline distinguished name string
Sets distinguished name by string. dnStr must be formatted as "/type0=value0/type1=value1/type2=value2...". No need to escape a slash in an attribute value.
Sets distinguished name by string. dnStr must be formatted as "/type0=value0/type1=value1/type2=value2...". No need to escape a slash in an attribute value.
name = new KJUR.asn1.x509.X500Name(); name.setByString("/C=US/O=aaa/OU=bbb/CN=foo@example.com"); // no need to escape slash in an attribute value name.setByString("/C=US/O=aaa/CN=1980/12/31");
- Parameters:
- {String} dnStr
- distinguished name by string (ex. /C=US/O=aaa)