code: private String getCertificateFingerPrint(String mdAlg) {
          String fingerPrint = "";
          try {
              byte[] encCertInfo = getEncoded();
              MessageDigest md = MessageDigest.getInstance(mdAlg);
              byte[] digest = md.digest(encCertInfo);
              StringBuffer buf = new StringBuffer();
              for (int i = 0; i < digest.length; i++) {
                  byte2hex(digest[i], buf);
              }
              fingerPrint = buf.toString();
          } catch (NoSuchAlgorithmException | CertificateEncodingException e) {
              // ignored
          }
          return fingerPrint;
      }
docs: Gets the requested finger print of the certificate. The result
  only contains 0-9 and A-F. No small case, no colon.