byte[] value = x509.getExtensionValue("2.5.29.14"); for (int i=4; i<Math.min(24,value.length); i++) { buff.append(Integer.toHexString((value[i] & 0xFF)|0x100).substring(1,3)).append(":");
try { String fingerprint = Encoding.hashMD5(cert.getEncoded()); for (int i=0; i<fingerprint.length(); i+=2) { buff.append(fingerprint.substring(i, i+1)).append(":"); } buff.deleteCharAt(buff.length()-1); } catch (CertificateEncodingException e) { throw new KeyStoreException(e.getMessage());
    public String getFingerPrint(Certificate cert) {        if (!(cert instanceof X509Certificate)) return null;        StringBuffer buff = new StringBuffer();        X509Certificate x509 = (X509Certificate) cert;        byte[] value = x509.getExtensionValue("2.5.29.14");        for (int i=4; i<Math.min(24,value.length); i++) {            buff.append(Integer.toHexString((value[i] & 0xFF)|0x100).substring(1,3)).append(":");        }        String dn = x509.getSubjectDN().getName();        buff.deleteCharAt(buff.length()-1);        _logger.info("Fingerprint is " + buff.toString().toUpperCase());        return buff.toString().toUpperCase() + " " + dn;    }