1

I'm trying to create a p12 file (pkcs12). I know that i need a certificate and a private key to create it. I read the certificate from smart card, but i have problems with private key. I know that in smart card there is a private key, but i cannot extract it...is it true? There is another way to use the private key stored in smart card and use it to create the p12 file?

I want to use this code:

 KeyStore store = KeyStore.getInstance("PKCS12");  
 store.load(null, null);


 store.setKeyEntry("Eric's Key", privKey, null, certificate);

 FileOutputStream fOut = new FileOutputStream("id.p12");

 store.store(fOut, passwd);

Any suggestion please? Thanks

4

1 に答える 1

0

いいえ、通常、スマート カードから秘密鍵を抽出することはできません。バックアップ機能やキーラッピング機能が利用できる場合もありますが、そのためには特別なアクセスが必要になります。PKCS#12 はキーと証明書を格納するためのバイナリ形式であるため、秘密キーを作成するには秘密キーにアクセスする必要があります。

于 2013-01-03T16:49:23.300 に答える