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.
Constructor Attributes | Constructor Name and Description |
---|---|
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:
|
- Fields borrowed from class KJUR.asn1.ASN1Object:
- hL, hT, hTLV, hV, isModified
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:
NOTE2: DSA/ECDSA is also supported for CA signging key from asn1x509 1.0.6.
As for argument 'params' for constructor, you can specify one of following properties:
- tbscertobj - specify KJUR.asn1.x509.TBSCertificate object
- prvkeyobj - specify RSAKey, KJUR.crypto.ECDSA or KJUR.crypto.DSA object for CA private key to sign the certificate
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();