有没有办法从NSS中提取密钥

时间:2012-08-27 10:25:25

标签: java cryptography fips nss

我使用NSS作为我的密钥库。我生成了一个密钥,用于加密/解密敏感数据(使用AES),一切正常。

为了便于携带,有没有一种方法可以提取这个密钥并将其插回到不同的NSS DB中?

我在SunPKCS11提供商处使用jre6。我正在生成密钥如下

KeyStore ks = //get NSS keystore
    KeyGenerator kg = KeyGenerator.getInstance("AES");
    kg.init(128);
    SecretKey skey = kg.generateKey();
    ks.setEntry(SECREY_KEY, new KeyStore.SecretKeyEntry(skey), 
            new KeyStore.PasswordProtection(pw.toCharArray()));

1 个答案:

答案 0 :(得分:0)

尝试使用NSS工具包,它有a utility从NSS密钥库中提取PKCS#12密钥:

http://www.mozilla.org/projects/security/pki/nss/tools/

相关问题