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, section 5.1.2.2.
-
Constructor Summary
ConstructorsConstructorDescriptionDigest
(HashAlgorithm alg, com.nimbusds.jose.util.Base64 value) Creates a new cryptographic digest. -
Method Summary
Modifier and TypeMethodDescriptionstatic Digest
compute
(HashAlgorithm alg, byte[] content) Computes the digest for the specified content.static Digest
compute
(HashAlgorithm alg, com.nimbusds.jose.util.Base64 content) Computes the digest for the specified content.boolean
Returns the hash algorithm.com.nimbusds.jose.util.Base64
getValue()
Returns the hash value.int
hashCode()
boolean
matches
(com.nimbusds.jose.util.Base64 content) Returnstrue
if this digest matches the computed for the specified content.static Digest
parse
(net.minidev.json.JSONObject jsonObject) Parses a digest from the specified JSON object.net.minidev.json.JSONObject
Returns 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
Returnstrue
if this digest matches the computed for the specified content.- Parameters:
content
- The content. Must not benull
.- Returns:
- If
true
if 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.
-