Class FingerprintHelper

java.lang.Object
org.italiangrid.voms.util.FingerprintHelper

public class FingerprintHelper extends Object
A utility class for computing fingerprints of X.509 certificates.

This class provides methods to generate a cryptographic fingerprint (hash) of an X.509 certificate using a specified digest algorithm.

The default digest algorithm used is SHA-1.

  • Field Details

    • DEFAULT_DIGEST_ALGORITHM

      public static final String DEFAULT_DIGEST_ALGORITHM
      The default message digest algorithm used for computing fingerprints.
      See Also:
  • Constructor Details

    • FingerprintHelper

      public FingerprintHelper()
  • Method Details

    • hexify

      private static String hexify(byte[] bytes)
      Converts a byte array to a hexadecimal string representation.
      Parameters:
      bytes - the byte array to convert
      Returns:
      a string containing the hexadecimal representation of the byte array
    • getFingerprint

      public static String getFingerprint(X509Certificate cert) throws NoSuchAlgorithmException, CertificateEncodingException
      Computes the fingerprint of an X.509 certificate using the default digest algorithm.
      Parameters:
      cert - the X.509 certificate for which to compute the fingerprint
      Returns:
      the fingerprint of the certificate as a hexadecimal string
      Throws:
      NoSuchAlgorithmException - if the specified digest algorithm is not available
      CertificateEncodingException - if encoding the certificate fails