Package org.italiangrid.voms.util
Class FingerprintHelper
- java.lang.Object
-
- org.italiangrid.voms.util.FingerprintHelper
-
public class FingerprintHelper extends java.lang.ObjectA 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
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_DIGEST_ALGORITHMThe default message digest algorithm used for computing fingerprints.
-
Constructor Summary
Constructors Constructor Description FingerprintHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetFingerprint(java.security.cert.X509Certificate cert)Computes the fingerprint of an X.509 certificate using the default digest algorithm.private static java.lang.Stringhexify(byte[] bytes)Converts a byte array to a hexadecimal string representation.
-
-
-
Field Detail
-
DEFAULT_DIGEST_ALGORITHM
public static final java.lang.String DEFAULT_DIGEST_ALGORITHM
The default message digest algorithm used for computing fingerprints.- See Also:
- Constant Field Values
-
-
Method Detail
-
hexify
private static java.lang.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 java.lang.String getFingerprint(java.security.cert.X509Certificate cert) throws java.security.NoSuchAlgorithmException, java.security.cert.CertificateEncodingExceptionComputes 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:
java.security.NoSuchAlgorithmException- if the specified digest algorithm is not availablejava.security.cert.CertificateEncodingException- if encoding the certificate fails
-
-