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, params
Method Attributes | Method Name and Description |
---|---|
<static> |
KJUR.asn1.x509.X500Name.compatToLDAP(s)
convert OpenSSL compat distinguished name format string to LDAP(RFC 2253) format
This static method converts a distinguished name string in OpenSSL compat format to LDAP(RFC 2253) format. |
<static> |
KJUR.asn1.x509.X500Name.ldapToCompat(s)
convert LDAP(RFC 2253) distinguished name format string to OpenSSL compat format
This static method converts a distinguished name string in LDAP(RFC 2253) format to OpenSSL compat format. |
<static> |
KJUR.asn1.x509.X500Name.ldapToOneline(s)
convert LDAP(RFC 2253) distinguished name format string to OpenSSL compat format (DEPRECATED)
This method is deprecated. |
<static> |
KJUR.asn1.x509.X500Name.onelineToLDAP(s)
convert OpenSSL compat distinguished name format string to LDAP(RFC 2253) format (DEPRECATED)
This method is deprecated. |
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, tohex
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.
Argument for the constructor can be one of following parameters:
NOTE1: The "array" and "rule" parameters have been supported since jsrsasign 9.0.0 asn1x509 2.0.0.
NOTE2: Multi-valued RDN in "str" parameter have been 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 }
Argument for the constructor can be one of following parameters:
- {Array}array - array of KJUR.asn1.x509.RDN parameter
- `String}str - string for distingish name in OpenSSL One line foramt (ex: /C=US/O=test/CN=test) See this in detail.
- {String}ldapstr - string for distinguish name in LDAP format (ex: CN=test,O=test,C=US)
- {String}hex - hexadecimal string for ASN.1 distinguish name structure
- {String}certissuer - issuer name in the specified PEM certificate
- {String}certsubject - subject name in the specified PEM certificate
- {String}rule - DirectoryString rule (ex. "prn" or "utf8")
NOTE1: The "array" and "rule" parameters have been supported since jsrsasign 9.0.0 asn1x509 2.0.0.
NOTE2: Multi-valued RDN in "str" parameter have been supported since jsrsasign 6.2.1 asn1x509 1.0.17.
// 1. construct with array new KJUR.asn1.x509.X500Name({array:[ [{type:'C',value:'JP',ds:'prn'}], [{type:'O',value:'aaa',ds:'utf8'}, // multi-valued RDN {type:'CN',value:'bob@example.com',ds:'ia5'}] ]}) // 2. construct with string new KJUR.asn1.x509.X500Name({str: "/C=US/ST=NY/L=Ballston Spa/STREET=915 Stillwater Ave"}); new KJUR.asn1.x509.X500Name({str: "/CN=AAA/2.5.4.42=John/surname=Ray"}); new KJUR.asn1.x509.X500Name({str: "/C=US/O=aaa+CN=contact@example.com"}); // multi valued // 3. construct by LDAP string new KJUR.asn1.x509.X500Name({ldapstr: "CN=foo@example.com,OU=bbb,C=US"}); // 4. construct by ASN.1 hex string new KJUR.asn1.x509.X500Name({hex: "304c3120..."}); // 5. construct by issuer of PEM certificate new KJUR.asn1.x509.X500Name({certsubject: "-----BEGIN CERT..."}); // 6. construct by subject of PEM certificate new KJUR.asn1.x509.X500Name({certissuer: "-----BEGIN CERT..."}); // 7. construct by object (DEPRECATED) 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.compatToLDAP(s)
convert OpenSSL compat distinguished name format string to LDAP(RFC 2253) format
This static method converts a distinguished name string in OpenSSL compat format to LDAP(RFC 2253) format.
This static method converts a distinguished name string in OpenSSL compat format to LDAP(RFC 2253) format.
KJUR.asn1.x509.X500Name.compatToLDAP("/C=US/O=test") → 'O=test,C=US' KJUR.asn1.x509.X500Name.compatToLDAP("/C=US/O=a,a") → 'O=a\,a,C=US'
- Parameters:
- {String} s
- distinguished name string in OpenSSL oneline compat (ex. /C=US/O=test)
- Since:
- jsrsasign 8.0.19 asn1x509 1.1.20
- Returns:
- {String} distinguished name string in LDAP(RFC 2253) format (ex. O=test,C=US)
- See:
- jsrsasign wiki: distinguished name string difference between OpenSSL compat and LDAP(RFC 2253)
- OpenSSL x509 command manual - NAME OPTIONS
<static>
{String}
KJUR.asn1.x509.X500Name.ldapToCompat(s)
convert LDAP(RFC 2253) distinguished name format string to OpenSSL compat format
This static method converts a distinguished name string in LDAP(RFC 2253) format to OpenSSL compat format.
This static method converts a distinguished name string in LDAP(RFC 2253) format to OpenSSL compat format.
KJUR.asn1.x509.X500Name.ldapToCompat('O=test,C=US') → '/C=US/O=test' KJUR.asn1.x509.X500Name.ldapToCompat('O=a\,a,C=US') → '/C=US/O=a,a' KJUR.asn1.x509.X500Name.ldapToCompat('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 8.0.19 asn1x509 1.1.10
- Returns:
- {String} distinguished name string in OpenSSL compat format (ex. /C=US/O=test)
<static>
{String}
KJUR.asn1.x509.X500Name.ldapToOneline(s)
convert LDAP(RFC 2253) distinguished name format string to OpenSSL compat format (DEPRECATED)
This method is deprecated. Please use KJUR.asn1.x509.X500Name.ldapToCompat instead.
This method is deprecated. Please use KJUR.asn1.x509.X500Name.ldapToCompat instead.
- 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 compat format (ex. /C=US/O=test)
<static>
{String}
KJUR.asn1.x509.X500Name.onelineToLDAP(s)
convert OpenSSL compat distinguished name format string to LDAP(RFC 2253) format (DEPRECATED)
This method is deprecated. Please use KJUR.asn1.x509.X500Name.compatToLDAP instead.
This method is deprecated. Please use KJUR.asn1.x509.X500Name.compatToLDAP instead.
- Parameters:
- {String} s
- distinguished name string in OpenSSL compat 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)
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
- See:
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)