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.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:
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.
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:
// 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

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