Class Index | File Index

Classes


Class KJUR.asn1.csr.CSRUtil

Certification Request (CSR/PKCS#10) utilities class
Defined in: asn1csr-1.0.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Certification Request (CSR/PKCS#10) utilities class
This class provides utility static methods for CSR/PKCS#10.
Method Summary
Method Attributes Method Name and Description
<static>  
KJUR.asn1.csr.CSRUtil.getParam(sPEM)
get field values from CSR/PKCS#10 PEM string
This method parses PEM CSR/PKCS#1 string and retrieves fields such as subject name and public key.
<static>  
KJUR.asn1.csr.CSRUtil.newCSRPEM(param)
generate a PEM format of CSR/PKCS#10 certificate signing request (DEPRECATED)
This method can generate a CSR certificate signing.
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:
Method Detail
<static> {Array} KJUR.asn1.csr.CSRUtil.getParam(sPEM)
get field values from CSR/PKCS#10 PEM string
This method parses PEM CSR/PKCS#1 string and retrieves fields such as subject name and public key. Following parameters are available in the resulted JSON object. Returned JSON object can be passed to KJUR.asn1.csr.CertificationRequest class constructor.
CAUTION: Returned JSON value format have been changed without backward compatibility since jsrsasign 9.0.0 asn1csr 2.0.0.
KJUR.asn1.csr.CSRUtil.getParam("-----BEGIN CERTIFICATE REQUEST...") →
{
  subject: { array:[[{type:"C",value:"JP",ds:"prn"}],...],
             str: "/C=JP/O=Test"},
  sbjpubkey: "-----BEGIN PUBLIC KEY...",
  extreq: [{extname:"subjectAltName",array:[{dns:"example.com"}]}]
  sigalg: "SHA256withRSA",
  sighex: "1ab3df.."
}
Parameters:
{String} sPEM
PEM string of CSR/PKCS#10
Since:
jsrsasign 9.0.0 asn1csr 2.0.0
Returns:
{Array} JSON object with parsed parameters such as name or public key
See:
KJUR.asn1.csr.CertificationRequest
KJUR.asn1.x509.X500Name
X509#getExtParamArray

<static> KJUR.asn1.csr.CSRUtil.newCSRPEM(param)
generate a PEM format of CSR/PKCS#10 certificate signing request (DEPRECATED)
This method can generate a CSR certificate signing.
// 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,
  extreq: [{
    extname: "subjectAltName",
    array: [{dns:"example.com"}]
  }]
});

// 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
Deprecated:
since jsrsasign 9.0.0 asn1csr 2.0.0. please use KJUR.asn1.csr.CertificationRequest constructor.
Since:
jsrsasign 4.9.0 asn1csr 1.0.0

© 2012-2020 Kenji Urushima, All rights reserved
Documentation generated by JsDoc Toolkit 2.4.0