code: public static String getFingerprint(final X509Certificate certificate,
  		final HashAlgorithm hashAlgorithm)
  		throws CertificateEncodingException, NoSuchAlgorithmException
  	{
  		final byte[] derEncoded = certificate.getEncoded();
  		final MessageDigest messageDigest = MessageDigest.getInstance(hashAlgorithm.getAlgorithm());
  		messageDigest.update(derEncoded);
  		final byte[] digest = messageDigest.digest();
  		final String fingerprint = HexExtensions.toHexString(digest);
  		return fingerprint;
  	}
docs: Gets the fingerprint from the given {@link X509Certificate} and the given algorithm.
  
  @param certificate
  the certificate
  @param hashAlgorithm
  the hash algorithm
  @return the fingerprint
  @throws CertificateEncodingException
  is thrown if an encoding error occurs.
  @throws NoSuchAlgorithmException
  is thrown if instantiation of the MessageDigest object fails.