Static variant when direct call will suffice.
final StringBuffer buf = new StringBuffer();
final String NL = "\n";
buf.append( "Issuer: " + cert.getIssuerDN().getName() + NL);
buf.append( "Issued to: " + cert.getSubjectDN().getName() + NL);
buf.append( "Version: " + cert.getVersion() + NL);
buf.append( "Not valid before: " + cert.getNotBefore() + NL);
buf.append( "Not valid after: " + cert.getNotAfter() + NL);
buf.append( "Serial number: " + cert.getSerialNumber() + NL);
buf.append( "Signature algorithm: " + cert.getSigAlgName() + NL);
buf.append( "Signature algorithm OID: " + cert.getSigAlgOID() + NL);
buf.append( "Signature fingerprint (MD5): " );
byte[] fingerprint = getFingerprint( cert.getSignature(), "MD5" );
buf.append( StringUtil.toHexString( fingerprint, ":" ) + NL );
buf.append( "Signature fingerprint (SHA1): " );
fingerprint = getFingerprint( cert.getSignature(), "SHA1" );
buf.append( StringUtil.toHexString( fingerprint, ":" ) + NL );
return( buf.toString() );