java keystoreapi,为一个别名加载Java KeyStore?

Does anyone know if it is possible to load a KeyStore so that it only prompts for the password for the given alias?

Example:

In my key store i have two private keys: Alice's Encryption Certificate and Bob's Encryption Certificate.

When i load my key store:

keyStore = KeyStore.getInstance("Windows-MY", "SunMSCAPI");

keyStore.load(null);

I am prompted for both Alice's and Bob's key store password. Once they are entered i can use getKey("Alice's Encryption Certificate", null); to retrieve Alice's private key. My keys are protected by Entrust's Security Provider, it is who prompts me for the passwords upon loading the key store. If i do not enter Bob's password and try to get his key it will return null, which is fine, but i would like to avoid the password prompt.

Is it possible to somehow specify that i only want Alice's key before loading the key store so i am never prompted for Bob's password?

Thanks.

解决方案

We had the same issue and couldn't find a way to do it. Basically, you are asking if there is a way to load the keystore partially. It makes things more complicated that MSCAPI provider ignores any password you provide.

We get around the issue by storing only one key With MSCAPI keystore. It turns out this works better with the security model of Smartcard also.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值