Object X509Cert
x509 certificate object
X509Cert object belongs to crypto Module, create:
1var k = new crypto.X509Cert();
Inheritance
Constructor
X509Cert
X509Cert constructor
1new X509Cert();
X509Cert constructor, load a certificate in DER format
1new X509Cert(Buffer derCert);
Call parameters:
- derCert: Buffer, DER format certificate
X509Cert constructor, load a certificate in CRT/PEM/TXT format
1new X509Cert(String txtCert);
Call parameters:
- txtCert: String, CRT/PEM/TXT format certificate
load Load mozilla's certdata,txt, which can be downloaded and used at http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
Member attributes
version
Integer, obtain the version of the certificate
1readonly Integer X509Cert.version;
serial
String, get the serial number of the certificate
1readonly String X509Cert.serial;
issuer
String, get the distinguished name of the certificate issuer
1readonly String X509Cert.issuer;
subject
String, the distinguished name of the subject to obtain the certificate
1readonly String X509Cert.subject;
notBefore
Date, the effective time of obtaining the certificate
1readonly Date X509Cert.notBefore;
notAfter
Date, the expiration time of the obtained certificate
1readonly Date X509Cert.notAfter;
ca
Boolean, whether the obtained certificate is a CA certificate
1readonly Boolean X509Cert.ca;
pathlen
Integer, pathlen to obtain the certificate
1readonly Integer X509Cert.pathlen;
usage
String, the scope of use to obtain the certificate
1readonly String X509Cert.usage;
The result is all or part of the following: digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign
type
String, Netscape certificate type to obtain the certificate
1readonly String X509Cert.type;
The result is all or part of the following: client, server, email, objsign, reserved, sslCA, emailCA, objCA
sig_md
Integer, the digest algorithm for obtaining the certificate
1readonly Integer X509Cert.sig_md;
sig_pk
Integer, the signature algorithm for obtaining the certificate
1readonly Integer X509Cert.sig_pk;
publicKey
PKey, Get the public key of the certificate
1readonly PKey X509Cert.publicKey;
next
X509Cert, get the next certificate in the certificate chain
1readonly X509Cert X509Cert.next;
Member function
load
Load a certificate in DER format, which can be called multiple times
1X509Cert.load(Buffer derCert);
Call parameters:
- derCert: Buffer, DER format certificate
Load a certificate in CRT/PEM/TXT format, which can be called multiple times
1X509Cert.load(String txtCert);
Call parameters:
- txtCert: String, CRT/PEM/TXT format certificate
load Load mozilla's certdata,txt, which can be downloaded and used at http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
loadFile
Load a certificate in CRT/PEM/DER/TXT format, which can be called multiple times
1X509Cert.loadFile(String filename);
Call parameters:
- filename: String, certificate file name
loadFile loads mozilla's certdata,txt, which can be downloaded and used at http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
loadRootCerts
Load the default root certificate that comes with it
1X509Cert.loadRootCerts();
The content of this certificate comes from: http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
verify
Use the current certificate chain to verify the given certificate
1Boolean X509Cert.verify(X509Cert cert) async;
Call parameters:
- cert: X509Cert, given the certificate to be verified
Return result:
- Boolean, Return True if the verification is successful
dump
Export the loaded certificate
1Array X509Cert.dump(Boolean pem = true);
Call parameters:
- pem: Boolean, specify to output the revoked certificate in PEM format, the default is true
Return result:
- Array, Export the certificate chain as an array
clear
Clear the loaded certificate
1X509Cert.clear();
toString
Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics
1String X509Cert.toString();
Return result:
- String, Returns the string representation of the object
toJSON
Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object
1Value X509Cert.toJSON(String key = "");
Call parameters:
- key: String, unused
Return result:
- Value, Returns a value containing JSON serializable