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 |
---|---|
<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:
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
- (DEPRECATED)rsaprvkey - specify RSAKey object CA private key
- (DEPRECATED)rsaprvpem - specify PEM string of RSA CA private key
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();