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
 
get PEM formatted certificate string after signed
 
set signature value internally by hex string
 
sign()
sign TBSCertificate and set signature value internally
Methods borrowed from class KJUR.asn1.ASN1Object:
getEncodedHex, getLengthHexFromValue, getValueHex
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
getPEMString()
get PEM formatted certificate string after signed
var cert = new KJUR.asn1.x509.Certificate({'tbscertobj': tbs, 'prvkeyobj': prvKey});
cert.sign();
var sPEM = cert.getPEMString();
Returns:
PEM formatted string of 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

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

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