Firefox Addon PKCS#11 API [英] Firefox Addon PKCS#11 API
问题描述
我发现一些接口看起来像我可以访问模块,插槽和令牌( 1 → 2 → 4 )但是我怎样才能访问存储在这个令牌上的证书的公钥呢? p>
是否有一个这样的API甚至可用于Addon?
nsIX509CertDB.idl 提供了访问所有存储的证书的手段,因此也是通过加密模块访问的证书。使用tokenName属性来过滤证书应该是有效的。
这是枚举所有证书的一个片段:
var certDB = chrome.Cc [@ mozilla.org/security/x509certdb;1\"].getService(chrome.Ci.nsIX509CertDB);
var certs = certDB.getCerts();
var enumerator = certs.getEnumerator();
var s =;
while(enumerator.hasMoreElements()){
var cert = enumerator.getNext()。QueryInterface(chrome.Ci.nsIX509Cert);
$ b $ if(cert.tokenName.equals(Your-token-name))
s + = cert.tokenName +#;
$ / code>
令牌的名称可以通过模块名称找到:<一个href =http://mxr.mozilla.org/mozilla-central/source/security/manager/ssl/nsIPKCS11ModuleDB.idl =nofollow> nsIPKCS11ModuleDB.listModules()→ nsIPKCS11Module.listSlots()→ nsIPKCS11Slot.getToken()→ nsIPK11Token.tokenName
I want to access the currenly connected cryptography modules via an Firefox Addon.
I found some interfaces that look like i can access the module, the slot and the token (1 → 2 → 3 → 4) but how can i access the public key of an certificate stored on such a token?
Is there an such an API even available to an Addon?
nsIX509CertDB.idl provides the means to access all stored certificates, therefore also the ones accessed through crypto modules. To filter the certificates using the tokenName property should work.
Here is a snippet to enumerate all certs:
var certDB = chrome.Cc["@mozilla.org/security/x509certdb;1"].getService(chrome.Ci.nsIX509CertDB);
var certs = certDB.getCerts();
var enumerator = certs.getEnumerator();
var s = "";
while (enumerator.hasMoreElements()) {
var cert = enumerator.getNext().QueryInterface(chrome.Ci.nsIX509Cert);
if (cert.tokenName.equals("Your-token-name"))
s += cert.tokenName + " # ";
}
The name of the token can be found through the module name by using: nsIPKCS11ModuleDB.listModules() → nsIPKCS11Module.listSlots() → nsIPKCS11Slot.getToken() → nsIPK11Token.tokenName
这篇关于Firefox Addon PKCS#11 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!