Package eu.europa.esig.dss.enumerations
Enum Class DigestAlgorithm
- All Implemented Interfaces:
OidAndUriBasedEnum
,OidBasedEnum
,UriBasedEnum
,Serializable
,Comparable<DigestAlgorithm>
,Constable
Supported Algorithms
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionMD2MD5RIPEMD160SHA-1SHA-224SHA-256SHA3-224SHA3-256SHA3-384SHA3-512SHA-384SHA-512SHAKE-128SHAKE-256SHAKE-256 + output 512bitsWHIRLPOOL -
Method Summary
Modifier and TypeMethodDescriptionstatic DigestAlgorithm
forHttpHeader
(String hashName) Returns the digest algorithm associated to the given JWS Http Header Hash Algorithm.static DigestAlgorithm
Returns the digest algorithm associated with the given identifier, according to TS 119 182-1, Annex E (Digest algorithms identifiers for JAdES signatures)static DigestAlgorithm
forJavaName
(String javaName) Returns the digest algorithm associated to the given JCE name.static DigestAlgorithm
Returns the digest algorithm associated to the given name.static DigestAlgorithm
forName
(String name, DigestAlgorithm defaultValue) Returns the digest algorithm associated to the given name.static DigestAlgorithm
Returns the digest algorithm associated to the given OID.static DigestAlgorithm
Returns the digest algorithm associated to the given XML url.Get the algorithm name according to RFC 5843Get the algorithm id used in JAdES Signatures.Get the JCE algorithm nameGet a new instance of MessageDigest for the current digestAlgorithmgetMessageDigest
(Provider provider) Get a new instance of MessageDigest for the current digestAlgorithmgetName()
Get the algorithm namegetOid()
Get the algorithm OIDint
Get the salt length (PSS)getUri()
Get the algorithm uristatic boolean
isSupportedAlgorithm
(String name) Returns indication if the algorithm with givenname
is supportedstatic DigestAlgorithm
Returns the enum constant of this class with the specified name.static DigestAlgorithm[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SHA1
SHA-1 -
SHA224
SHA-224 -
SHA256
SHA-256 -
SHA384
SHA-384 -
SHA512
SHA-512 -
SHA3_224
SHA3-224 -
SHA3_256
SHA3-256 -
SHA3_384
SHA3-384 -
SHA3_512
SHA3-512 -
SHAKE128
SHAKE-128 -
SHAKE256
SHAKE-256 -
SHAKE256_512
SHAKE-256 + output 512bits -
RIPEMD160
RIPEMD160 -
MD2
MD2 -
MD5
MD5 -
WHIRLPOOL
WHIRLPOOL
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
forName
Returns the digest algorithm associated to the given name.- Parameters:
name
- the algorithm name- Returns:
- the digest algorithm linked to the given name
- Throws:
IllegalArgumentException
- if the given name doesn't match any algorithm
-
forName
Returns the digest algorithm associated to the given name.- Parameters:
name
- the algorithm namedefaultValue
- The default value for theDigestAlgorithm
- Returns:
- the corresponding
DigestAlgorithm
or the default value
-
isSupportedAlgorithm
-
forJavaName
Returns the digest algorithm associated to the given JCE name.- Parameters:
javaName
- the JCE algorithm name- Returns:
- the digest algorithm linked to the given name
- Throws:
IllegalArgumentException
- if the given name doesn't match any algorithm
-
forOID
Returns the digest algorithm associated to the given OID.- Parameters:
oid
- the algorithm oid- Returns:
- the digest algorithm linked to the oid
- Throws:
IllegalArgumentException
- if the oid doesn't match any digest algorithm
-
forXML
Returns the digest algorithm associated to the given XML url.- Parameters:
xmlName
- the algorithm uri- Returns:
- the digest algorithm linked to the given uri
- Throws:
IllegalArgumentException
- if the uri doesn't match any digest algorithm
-
forJAdES
Returns the digest algorithm associated with the given identifier, according to TS 119 182-1, Annex E (Digest algorithms identifiers for JAdES signatures)- Parameters:
algoId
-String
JAdES algorithm identifier- Returns:
- the digest algorithm linked to the given identifier
- Throws:
IllegalArgumentException
- if the name doesn't match any digest algorithm
-
forHttpHeader
Returns the digest algorithm associated to the given JWS Http Header Hash Algorithm. See RFC 5843.- Parameters:
hashName
- the algorithm name by RFC 5843- Returns:
- the digest algorithm linked to the given name
- Throws:
IllegalArgumentException
- if the name doesn't match any digest algorithm
-
getName
-
getJavaName
-
getOid
Get the algorithm OID- Specified by:
getOid
in interfaceOidBasedEnum
- Returns:
- the ASN1 algorithm OID
-
getUri
Get the algorithm uri- Specified by:
getUri
in interfaceUriBasedEnum
- Returns:
- the algorithm uri
-
getJAdESId
Get the algorithm id used in JAdES Signatures. TS 119-182 Annex E (normative): Digest algorithms identifiers for JAdES signatures- Returns:
- the algorithm JAdES identifier
-
getHttpHeaderAlgo
Get the algorithm name according to RFC 5843- Returns:
- the algorithm name
-
getSaltLength
public int getSaltLength()Get the salt length (PSS)- Returns:
- the salt length
-
getMessageDigest
Get a new instance of MessageDigest for the current digestAlgorithm- Returns:
- an instance of MessageDigest
- Throws:
NoSuchAlgorithmException
- if the algorithm is not supported
-
getMessageDigest
Get a new instance of MessageDigest for the current digestAlgorithm- Parameters:
provider
- the security provider to be used- Returns:
- an instance of MessageDigest
- Throws:
NoSuchAlgorithmException
- if the algorithm is not supported
-