繁体   English   中英

使用Microsoft Crypto API时如何隐藏和使用对话框(Windows证书存储)

[英]How to hide and use dialog boxes when using Microsoft Crypto API (Windows Certificate Store)

我想在我的Java应用程序中利用Windows证书存储。 我可以从Windows-MY加载具有我所需的所有别名/证书的密钥库,但是在加载它时,我会遇到一个对话框,询问“请插入智能卡”。 如果我单击取消几次,它们的密钥库仍然会加载正确的内容。

有没有办法隐藏此对话框? 还可以使用Java中的Windows证书选择框吗? 我在网上看到的唯一答案是: https : //social.msdn.microsoft.com/Forums/en-US/52dca221-1e05-44c1-8c45-9e0d4a807853/java-keystoreload-for-windowsmy-pops- up-insert-smart-card-window?forum = windowssecurity ,但是我不想删除任何内容,因为我不希望用户这样做。

这是我加载密钥库的方式:

KeyStore ks = KeyStore.getInstance("Windows-MY");
ks.load(null, null);

我从未尝试通过密钥库加载证书,而是通过系统属性来提供它们。

System.setProperty("javax.net.ssl.keyStoreType", "Windows-MY");
System.setProperty("javax.net.ssl.keyStore", "NONE");
System.setProperty("javax.net.ssl.trustStoreType", "Windows-ROOT");
System.setProperty("javax.net.ssl.trustStore", "NONE");

另请参见java SSL和cert密钥库以及如何将Windows密钥库(MCS)与JDBC一起使用?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM