Pfx base encoded string to p12 certificates

468 Views Asked by At

I have my P12 certificates saved on a cloud environment and I am fetching those certificates in Java from an environment variable. Now I getting a PFX base 64 encoded string and password. I want to convert the string back to P12 certificates. Does anyone know how to do that?

1

There are 1 best solutions below

0
On

You can decode the base64 string to a byte[], then make a ByteArrayInputStream out of it. Then simply read from it with keystore methods like this: KeyStore ks = KeyStore.getInstance("PKCS12"); ks.load(byteArrInputStream, "password".toCharArray());