从命令行调用nsIX509CertDB.nsIX509CertDB时失败 [英] Failure while calling nsIX509CertDB.nsIX509CertDB from command line

查看:330
本文介绍了从命令行调用nsIX509CertDB.nsIX509CertDB时失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图开发一个FF扩展,调用nsIX509CertDB.nsIX509CertDB。当从xpcshell调用此函数时,我收到错误0x80004005(NS_ERROR_FAILURE)。我怀疑它是失败,因为在xpcshell环境中,我不能提示输入密码。有没有办法从命令行提供它?

I'm trying to develop a FF extension that calls nsIX509CertDB.nsIX509CertDB. When calling this function from a xpcshell I alwas receive a error 0x80004005 (NS_ERROR_FAILURE). I suspect it to be failing since in a xpcshell environment I can not be prompted for the password. Is there any way to provide it from the command line?

我的代码:

if(nsIFile != null && nsIFile.exists()) {
        var certDB = Cc["@mozilla.org/security/x509certdb;1"]
                                        .getService(Ci.nsIX509CertDB);
        certDB.importPKCS12File(null, nsIFile);
}


推荐答案

代码替换 @ mozilla.org / nsCertificateDialogs; 1 组件(实现 nsICertificateDialogs interface )。

This would most likely involve writing code to replace @mozilla.org/nsCertificateDialogs;1 component (implementing nsICertificateDialogs interface). Then you could implement getPKCS12FilePassword method any way you like.

更简单的方法是使用

The simpler approach would be using pk12util tool included in NSS. Unless this really needs to be done via xpcshell of course.

这篇关于从命令行调用nsIX509CertDB.nsIX509CertDB时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆