Class KJUR.asn1.csr.CSRUtil
Certification Request (CSR/PKCS#10) utilities class
Defined in: asn1csr-1.0.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Certification Request (CSR/PKCS#10) utilities class
This class provides utility static methods for CSR/PKCS#10. |
Method Attributes | Method Name and Description |
---|---|
<static> |
KJUR.asn1.csr.CSRUtil.getInfo(sPEM)
get field values from CSR/PKCS#10 PEM string
This method parses PEM CSR/PKCS#1 string and retrieves subject name and public key. |
<static> |
KJUR.asn1.csr.CSRUtil.newCSRPEM(param)
generate a PEM format of CSR/PKCS#10 certificate signing request
This method can generate a CSR certificate signing
request by a simple JSON object which has following parameters:
|
Class Detail
KJUR.asn1.csr.CSRUtil()
Certification Request (CSR/PKCS#10) utilities class
This class provides utility static methods for CSR/PKCS#10. Here is a list of methods:
This class provides utility static methods for CSR/PKCS#10. Here is a list of methods:
Method Detail
<static>
{Object}
KJUR.asn1.csr.CSRUtil.getInfo(sPEM)
get field values from CSR/PKCS#10 PEM string
This method parses PEM CSR/PKCS#1 string and retrieves subject name and public key. Following parameters are available in the resulted JSON object.
This method parses PEM CSR/PKCS#1 string and retrieves subject name and public key. Following parameters are available in the resulted JSON object.
- subject.name - subject name string (ex. /C=US/O=Test)
- subject.hex - hexadecimal string of X.500 Name of subject
- pubkey.obj - subject public key object such as RSAKey, KJUR.crypto.{ECDSA,DSA}
- pubkey.hex - hexadecimal string of subject public key
o = KJUR.asn1.csr.CSRUtil.getInfo("-----BEGIN CERTIFICATE REQUEST..."); console.log(o.subject.name) → "/C=US/O=Test"
- Parameters:
- {String} sPEM
- PEM string of CSR/PKCS#10
- Since:
- jsrsasign 6.1.3 asn1csr 1.0.1
- Returns:
- {Object} JSON object with parsed parameters such as name or public key
<static>
KJUR.asn1.csr.CSRUtil.newCSRPEM(param)
generate a PEM format of CSR/PKCS#10 certificate signing request
This method can generate a CSR certificate signing
request by a simple JSON object which has following parameters:
- subject - parameter to be passed to KJUR.asn1.x509.X500Name
- sbjpubkey - parameter to be passed to KEYUTIL.getKey
- sigalg - signature algorithm name (ex. SHA256withRSA)
- sbjprvkey - parameter to be passed to KEYUTIL.getKey
// 1) by key object pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({ subject: {str: '/C=US/O=Test/CN=example.com'}, sbjpubkey: pubKeyObj, sigalg: "SHA256withRSA", sbjprvkey: prvKeyObj }); // 2) by private/public key PEM pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({ subject: {str: '/C=US/O=Test/CN=example.com'}, sbjpubkey: pubKeyPEM, sigalg: "SHA256withRSA", sbjprvkey: prvKeyPEM }); // 3) with generateKeypair kp = KEYUTIL.generateKeypair("RSA", 2048); pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({ subject: {str: '/C=US/O=Test/CN=example.com'}, sbjpubkey: kp.pubKeyObj, sigalg: "SHA256withRSA", sbjprvkey: kp.prvKeyObj }); // 4) by private/public key PEM with extension pem = KJUR.asn1.csr.CSRUtil.newCSRPEM({ subject: {str: '/C=US/O=Test/CN=example.com'}, ext: [ {subjectAltName: {array: [{dns: 'example.net'}]} ], sbjpubkey: pubKeyPEM, sigalg: "SHA256withRSA", sbjprvkey: prvKeyPEM });
- Parameters:
- {Array} param
- parameter to generate CSR
- Since:
- jsrsasign 4.9.0 asn1csr 1.0.0