Package org.italiangrid.voms.util
Class FingerprintHelper
java.lang.Object
org.italiangrid.voms.util.FingerprintHelper
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The default message digest algorithm used for computing fingerprints. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
DEFAULT_DIGEST_ALGORITHM
The default message digest algorithm used for computing fingerprints.- See Also:
-
-
Constructor Details
-
FingerprintHelper
public FingerprintHelper()
-
-
Method Details
-
hexify
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 availableCertificateEncodingException
- if encoding the certificate fails
-