Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

I've posted a clean, working solution for using .p12 / pkcs12 certificates in Java in another StackOverflow answer here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top