I am trying to read a certificate for a remote host using Java. I want to get the encoding type. I typed:
System.out.println("The encoding is: "+ x509Cert.getEncoded().toString());
The output I get is:
The encoding is: [B@597c3925
What is the problem ?
EDIT: x509Cert is an object of type X509Certificate.
Certificate.getEncodedreturnsbyte[], because it gives you a binary representation of the certificate data (DER in the case of X509 certificates), not text. If you want it in PEM format then that is the DER form encoded using MIME-style base 64 (you can use Apache commons codec for this) and with the familiar begin and end lines added.