-2

I have pfx file and I need to encrypt a data by using it and Java. First I converted it to a .pem file.

But still I do not know what to do with both now.

Tim Tuckle
  • 1,372
  • 7
  • 21
  • 31

1 Answers1

1

A PFX file is a PKCS#12 file. You can load PKCS#12 key/certificate stores using the KeyStore (and "algorithm" string "PKCS12") functionality in Java, after which you can retrieve the contents of the KeyStore and use the keys / certificates.

It is better to keep the PFX key store to binary BER / P12 rather than PEM to be compatible with Java. There is a PEM decoder in the Bouncy Castle API, but using the binary file directly should be preferred.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263