Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sign data with .p12 file in Java?

How to sign data with .p12 file in Java?

Java seems to support only until pkcs11, I just can't find the standard library for pkcs12. There's nothing in 'java.security'... for decoding .p12 file to get private key to perform signing.

Any solution? I'm creating an applet so it's good if there's a small library available, but not those libraries of 1MB or above.

like image 457
jondinham Avatar asked Dec 02 '11 14:12

jondinham


1 Answers

You can open an p12 file as a keystore.

http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#KeystoreFormats

After opening the keystore you can retrieve the private key and use it for signing your data.

like image 200
Ulf Jaehrig Avatar answered Oct 16 '22 09:10

Ulf Jaehrig