Last active
August 29, 2015 14:17
-
-
Save mozkeeler/3531c27239d92bc1535c to your computer and use it in GitHub Desktop.
listing built-in roots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { 'classes': Cc, 'interfaces': Ci } = Components; | |
let certdb = Cc["@mozilla.org/security/x509certdb;1"] | |
.getService(Ci.nsIX509CertDB); | |
let certs = certdb.getCerts(); | |
let enumerator = certs.getEnumerator(); | |
while (enumerator.hasMoreElements()) { | |
let cert = enumerator.getNext().QueryInterface(Ci.nsIX509Cert); | |
let sslTrust = certdb.isCertTrusted(cert, Ci.nsIX509Cert.CA_CERT, | |
Ci.nsIX509CertDB.TRUSTED_SSL); | |
let emailTrust = certdb.isCertTrusted(cert, Ci.nsIX509Cert.CA_CERT, | |
Ci.nsIX509CertDB.TRUSTED_EMAIL); | |
let objsignTrust = certdb.isCertTrusted(cert, Ci.nsIX509Cert.CA_CERT, | |
Ci.nsIX509CertDB.TRUSTED_OBJSIGN); | |
dump("issuer: " + cert.issuerName + "\n"); | |
dump("serial: " + cert.serialNumber + "\n"); | |
dump("trust:\n"); | |
dump(" SSL:\t\t" + sslTrust + "\n"); | |
dump(" EMAIL:\t" + emailTrust + "\n"); | |
dump(" OBJSIGN:\t" + objsignTrust + "\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment