Class Index | File Index

Classes


Class KJUR.asn1.csr.CertificationRequest


Extends KJUR.asn1.ASN1Object.
ASN.1 CertificationRequest structure class
Defined in: asn1csr-1.0.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ASN.1 CertificationRequest structure class
Fields borrowed from class KJUR.asn1.ASN1Object:
hL, hT, hTLV, hV, isModified
Method Summary
Method Attributes Method Name and Description
 
get PEM formatted certificate signing request (CSR/PKCS#10)
This method is to a get CSR PEM string after signed.
 
sign()
sign CertificationRequest and set signature value internally
This method self-signs CertificateRequestInfo with a subject's private key and set signature value internally.
Methods borrowed from class KJUR.asn1.ASN1Object:
getEncodedHex, getLengthHexFromValue, getValueHex
Class Detail
KJUR.asn1.csr.CertificationRequest(params)
ASN.1 CertificationRequest structure class
csri = new KJUR.asn1.csr.CertificationRequestInfo();
csri.setSubjectByParam({'str': '/C=US/O=Test/CN=example.com'});
csri.setSubjectPublicKeyByGetKey(pubKeyObj);
csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
csr.sign("SHA256withRSA", prvKeyObj);
pem = csr.getPEMString();

// -- DEFINITION OF ASN.1 SYNTAX --
// CertificationRequest ::= SEQUENCE {
//   certificationRequestInfo CertificationRequestInfo,
//   signatureAlgorithm       AlgorithmIdentifier{{ SignatureAlgorithms }},
//   signature                BIT STRING }
//
// CertificationRequestInfo ::= SEQUENCE {
//   version       INTEGER { v1(0) } (v1,...),
//   subject       Name,
//   subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
//   attributes    [0] Attributes{{ CRIAttributes }} }
Parameters:
{Array} params
associative array of parameters (ex. {})
Since:
jsrsasign 4.9.0 asn1csr 1.0.0
Method Detail
getPEMString()
get PEM formatted certificate signing request (CSR/PKCS#10)
This method is to a get CSR PEM string after signed.
csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
csr.sign();
pem =  csr.getPEMString();
// pem will be following:
// -----BEGIN CERTIFICATE REQUEST-----
// MII ...snip...
// -----END CERTIFICATE REQUEST-----
Returns:
PEM formatted string of CSR/PKCS#10

sign()
sign CertificationRequest and set signature value internally
This method self-signs CertificateRequestInfo with a subject's private key and set signature value internally.
csr = new KJUR.asn1.csr.CertificationRequest({'csrinfo': csri});
csr.sign("SHA256withRSA", prvKeyObj);

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