Node.js
Node.js
Get Certificate Policy
See more Certificates Examples
Demonstrates how to get a certificate's policy OIDs (if any)Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
var cert = new chilkat.Cert();
success = cert.LoadFromFile("qa_data/certs/sample.cer");
if (success == false) {
console.log(cert.LastErrorText);
return;
}
// The certificatePolicies OID is 2.5.29.32
var oid = "2.5.29.32";
var strXml = cert.GetExtensionAsXml(oid);
if (cert.LastMethodSuccess == true) {
console.log(strXml);
// Sample result:
// <sequence><sequence><oid>2.16.840.1.101.2.1.11.39</oid></sequence></sequence>
var xml = new chilkat.Xml();
xml.LoadXml(strXml);
console.log("Policy OID = " + xml.GetChildContent("sequence|oid"));
}
}
chilkatExample();