Package eu.europa.esig.dss.enumerations
Enum DigestAlgorithm
- All Implemented Interfaces:
OidAndUriBasedEnum
,OidBasedEnum
,UriBasedEnum
,Serializable
,Comparable<DigestAlgorithm>
public enum DigestAlgorithm extends Enum<DigestAlgorithm> implements OidAndUriBasedEnum
Supported Algorithms
-
Enum Constant Summary
-
Method Summary
Modifier and Type Method Description static DigestAlgorithm
forJavaName(String javaName)
Returns the digest algorithm associated to the given JCE name.static DigestAlgorithm
forName(String name)
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
forOID(String oid)
Returns the digest algorithm associated to the given OID.static DigestAlgorithm
forXML(String xmlName)
Returns the digest algorithm associated to the given XML url.static DigestAlgorithm
forXML(String xmlName, DigestAlgorithm defaultValue)
Returns the digest algorithm associated to the given XML url or the default one if the algorithm does not exist.String
getJavaName()
Get the JCE algorithm nameMessageDigest
getMessageDigest()
Get a new instance of MessageDigest for the current digestAlgorithmMessageDigest
getMessageDigest(Provider provider)
Get a new instance of MessageDigest for the current digestAlgorithmString
getName()
Get the algorithm nameString
getOid()
Get the algorithm OIDint
getSaltLength()
Get the salt length (PSS)String
getUri()
Get the algorithm uristatic boolean
isSupportedAlgorithm(String name)
Returns indication if the algorithm with givenname
is supportedstatic DigestAlgorithm
valueOf(String name)
Returns the enum constant of this type with the specified name.static DigestAlgorithm[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type 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
Returns indication if the algorithm with givenname
is supported- Parameters:
name
-String
target algorithm's name- Returns:
- TRUE if the algorithm is supported, FALSE otherwise
-
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
-
forXML
Returns the digest algorithm associated to the given XML url or the default one if the algorithm does not exist.- Parameters:
xmlName
- The XML representation of the digest algorithmdefaultValue
- The default value for theDigestAlgorithm
- Returns:
- the corresponding
DigestAlgorithm
or the default value
-
getName
Get the algorithm name- Returns:
- the algorithm name
-
getJavaName
Get the JCE algorithm name- Returns:
- the java algorithm name
-
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
-
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
-