I've stored a certificate as a Base64 encoded string in the database. I can read this from the the database and decode it but I'd like to convert the decoded byte[] into a X509Certificate. I am looking for sample code to do this. I have tried:
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
InputStream in = new ByteArrayInputStream(bytes);
X509Certificate cert = (X509Certificate)certFactory.generateCertificate(in);
This leads to an issue with the encoding type. A valid sample String or byte[] that represents a certificate will be good.
Any pointers will be great! Thanks.