Class Index | File Index

Classes


Class KJUR.asn1.x509.Certificate


Extends KJUR.asn1.ASN1Object.
X.509 Certificate class to sign and generate hex encoded certificate
Defined in: asn1x509-1.0.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
X.509 Certificate class to sign and generate hex encoded certificate
As for argument 'params' for constructor, you can specify one of following properties: NOTE1: 'params' can be omitted.
Fields borrowed from class KJUR.asn1.ASN1Object:
hL, hT, hTLV, hV, isModified
Method Summary
Method Attributes Method Name and Description
<static>  
KJUR.asn1.x509.Certificate.getPEMString()
get PEM formatted certificate string after signed
<static>  
KJUR.asn1.x509.Certificate.setRsaPrvKeyByPEMandPass(rsaPEM, passPEM)
set PKCS#5 encrypted RSA PEM private key as CA key

EXAMPLES

<static>  
KJUR.asn1.x509.Certificate.setSignatureHex()
set signature value internally by hex string
<static>  
KJUR.asn1.x509.Certificate.sign()
sign TBSCertificate and set signature value internally
Class Detail
KJUR.asn1.x509.Certificate(params)
X.509 Certificate class to sign and generate hex encoded certificate
As for argument 'params' for constructor, you can specify one of following properties: NOTE1: 'params' can be omitted.
NOTE2: DSA/ECDSA is also supported for CA signging key from asn1x509 1.0.6.
var caKey = KEYUTIL.getKey(caKeyPEM); // CA's private key
var cert = new KJUR.asn1x509.Certificate({'tbscertobj': tbs, 'prvkeyobj': caKey});
cert.sign(); // issue certificate by CA's private key
var certPEM = cert.getPEMString();

// Certificate  ::=  SEQUENCE  {
//     tbsCertificate       TBSCertificate,
//     signatureAlgorithm   AlgorithmIdentifier,
//     signature            BIT STRING  }
Parameters:
{Array} params
associative array of parameters (ex. {'tbscertobj': obj, 'prvkeyobj': key})
Method Detail
<static> KJUR.asn1.x509.Certificate.getPEMString()
get PEM formatted certificate string after signed
var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
cert.sign();
var sPEM =  cert.getPEMString();
Returns:
PEM formatted string of certificate

<static> KJUR.asn1.x509.Certificate.setRsaPrvKeyByPEMandPass(rsaPEM, passPEM)
set PKCS#5 encrypted RSA PEM private key as CA key

EXAMPLES

var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
cert.setRsaPrvKeyByPEMandPass("-----BEGIN RSA PRIVATE..(snip)", "password");
Parameters:
{String} rsaPEM
string of PKCS#5 encrypted RSA PEM private key
{String} passPEM
passcode string to decrypt private key
Since:
1.0.1

<static> KJUR.asn1.x509.Certificate.setSignatureHex()
set signature value internally by hex string
var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs});
cert.setSignatureHex('01020304');
Since:
asn1x509 1.0.8

<static> KJUR.asn1.x509.Certificate.sign()
sign TBSCertificate and set signature value internally
var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'rsaprvkey': prvKey});
cert.sign();

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