ssl : Unable to load certificate

In my case I was trying to read my cer file and was receiving the error stated above openssl x509 -in CSR.csr -text -noout unable to load certificate 140518720210760:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:698:Expecting: TRUSTED CERTIFICATE I had to convert it to a crt file using openssl. openssl x509 -inform DER -in <certname>.cer -out <certname>.crt openssl x509 … Read more

Write x509 certificate into PEM formatted string in java?

This is not bad. Java doesn’t provide any functions to write PEM files. What you are doing is the correct way. Even KeyTool does the same thing, BASE64Encoder encoder = new BASE64Encoder(); out.println(X509Factory.BEGIN_CERT); encoder.encodeBuffer(cert.getEncoded(), out); out.println(X509Factory.END_CERT); If you use BouncyCastle, you can use PEMWriter class to write out X509 certificate in PEM.