Class Digest
java.lang.Object
com.nimbusds.openid.connect.sdk.assurance.evidences.attachment.Digest
Cryptographic digest.
Related specifications:
- OpenID Connect for Identity Assurance 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionDigest(HashAlgorithm alg, com.nimbusds.jose.util.Base64 value) Creates a new cryptographic digest. -
Method Summary
Modifier and TypeMethodDescriptionstatic Digestcompute(HashAlgorithm alg, byte[] content) Computes the digest for the specified content.static Digestcompute(HashAlgorithm alg, com.nimbusds.jose.util.Base64 content) Computes the digest for the specified content.booleanReturns the hash algorithm.com.nimbusds.jose.util.Base64getValue()Returns the hash value.inthashCode()booleanmatches(com.nimbusds.jose.util.Base64 content) Returnstrueif this digest matches the computed for the specified content.static Digestparse(net.minidev.json.JSONObject jsonObject) Parses a digest from the specified JSON object.net.minidev.json.JSONObjectReturns a JSON object representation of this cryptographic digest.
-
Constructor Details
-
Digest
Creates a new cryptographic digest.- Parameters:
alg- The hash algorithm. Must not benull.value- The hash value. Must not benull.
-
-
Method Details
-
getHashAlgorithm
Returns the hash algorithm.- Returns:
- The hash algorithm.
-
getValue
Returns the hash value.- Returns:
- the hash value.
-
matches
Returnstrueif this digest matches the computed for the specified content.- Parameters:
content- The content. Must not benull.- Returns:
- If
trueif the digest matches the content, elsefalse. - Throws:
NoSuchAlgorithmException- If the hash algorithm isn't supported.
-
toJSONObject
Returns a JSON object representation of this cryptographic digest.- Returns:
- The JSON object.
-
equals
-
hashCode
-
compute
public static Digest compute(HashAlgorithm alg, com.nimbusds.jose.util.Base64 content) throws NoSuchAlgorithmException Computes the digest for the specified content.- Parameters:
alg- The hash algorithm. Must not benull.content- The content. Must not benull.- Returns:
- The digest.
- Throws:
NoSuchAlgorithmException- If the hash algorithm isn't supported.
-
compute
Computes the digest for the specified content.- Parameters:
alg- The hash algorithm. Must not benull.content- The content. Must not benull.- Returns:
- The digest.
- Throws:
NoSuchAlgorithmException- If the hash algorithm isn't supported.
-
parse
Parses a digest from the specified JSON object.- Parameters:
jsonObject- The JSON object.- Returns:
- The cryptographic digest.
- Throws:
ParseException- If parsing failed.
-