Windows上智能卡的java密钥库和密码安全性

时间:2012-08-04 11:16:44

标签: java certificate keystore

http://docs.oracle.com/javase/6/docs/api/java/security/KeyStore.html

在下面的代码中,java应用程序向用户请求密码:

KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());

// get user password and file input stream
char[] password = getPassword();
java.io.FileInputStream fis =
    new java.io.FileInputStream("keyStoreName");
ks.load(fis, password);
fis.close();

这是否意味着应用程序可以获得我的数字证书密码,即使它是在智能卡上并可能用于其他东西?

1 个答案:

答案 0 :(得分:2)

是的,具有足够权限的另一个应用程序可以从内存中读取密码的内容,或者在输入键盘时隐藏密码。

代码示例显示了存储为char数组的密码,这是推荐的做法。与不可变的String不同,使用密码后,这些数组可以重置为不同的值。这可以最小化攻击窗口,但不会将其删除。

多家智能卡制造商提供外部密码键盘设备,确保密码直接发送到卡上。您可以考虑调查其中一种解决方案。