Package eu.europa.esig.dss.enumerations
Enum DigestAlgorithm
- java.lang.Object
-
- java.lang.Enum<DigestAlgorithm>
-
- eu.europa.esig.dss.enumerations.DigestAlgorithm
-
- All Implemented Interfaces:
OidBasedEnum,UriBasedEnum,Serializable,Comparable<DigestAlgorithm>
public enum DigestAlgorithm extends Enum<DigestAlgorithm> implements UriBasedEnum, OidBasedEnum
Supported Algorithms
-
-
Method Summary
Modifier and Type Method Description static DigestAlgorithmforJavaName(String javaName)Returns the digest algorithm associated to the given JCE name.static DigestAlgorithmforName(String name)Returns the digest algorithm associated to the given name.static DigestAlgorithmforName(String name, DigestAlgorithm defaultValue)Returns the digest algorithm associated to the given name.static DigestAlgorithmforOID(String oid)Returns the digest algorithm associated to the given OID.static DigestAlgorithmforXML(String xmlName)Returns the digest algorithm associated to the given XML url.static DigestAlgorithmforXML(String xmlName, DigestAlgorithm defaultValue)Returns the digest algorithm associated to the given XML url or the default one if the algorithm does not exist.StringgetJavaName()Get the JCE algorithm nameMessageDigestgetMessageDigest()Get a new instance of MessageDigest for the current digestAlgorithmMessageDigestgetMessageDigest(Provider provider)Get a new instance of MessageDigest for the current digestAlgorithmStringgetName()Get the algorithm nameStringgetOid()Get the algorithm OIDintgetSaltLength()Get the salt length (PSS)StringgetUri()Get the algorithm uristatic booleanisSupportedAlgorithm(String name)Returns indication if the algorithm with givennameis supportedstatic DigestAlgorithmvalueOf(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 Detail
-
SHA1
public static final DigestAlgorithm SHA1
-
SHA224
public static final DigestAlgorithm SHA224
-
SHA256
public static final DigestAlgorithm SHA256
-
SHA384
public static final DigestAlgorithm SHA384
-
SHA512
public static final DigestAlgorithm SHA512
-
SHA3_224
public static final DigestAlgorithm SHA3_224
-
SHA3_256
public static final DigestAlgorithm SHA3_256
-
SHA3_384
public static final DigestAlgorithm SHA3_384
-
SHA3_512
public static final DigestAlgorithm SHA3_512
-
RIPEMD160
public static final DigestAlgorithm RIPEMD160
-
MD2
public static final DigestAlgorithm MD2
-
MD5
public static final DigestAlgorithm MD5
-
WHIRLPOOL
public static final DigestAlgorithm WHIRLPOOL
-
-
Method Detail
-
values
public static DigestAlgorithm[] 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
public static DigestAlgorithm valueOf(String name)
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
public static DigestAlgorithm forName(String name)
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
public static DigestAlgorithm forName(String name, DigestAlgorithm defaultValue)
Returns the digest algorithm associated to the given name.- Parameters:
name- the algorithm namedefaultValue- The default value for theDigestAlgorithm- Returns:
- the corresponding
DigestAlgorithmor the default value
-
isSupportedAlgorithm
public static boolean isSupportedAlgorithm(String name)
Returns indication if the algorithm with givennameis supported- Parameters:
name-Stringtarget algorithm's name- Returns:
- TRUE if the algorithm is supported, FALSE otherwise
-
forJavaName
public static DigestAlgorithm forJavaName(String javaName)
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
public static DigestAlgorithm forOID(String oid)
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
public static DigestAlgorithm forXML(String xmlName)
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
public 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.- Parameters:
xmlName- The XML representation of the digest algorithmdefaultValue- The default value for theDigestAlgorithm- Returns:
- the corresponding
DigestAlgorithmor the default value
-
getName
public String getName()
Get the algorithm name- Returns:
- the algorithm name
-
getJavaName
public String getJavaName()
Get the JCE algorithm name- Returns:
- the java algorithm name
-
getOid
public String getOid()
Get the algorithm OID- Specified by:
getOidin interfaceOidBasedEnum- Returns:
- the ASN1 algorithm OID
-
getUri
public String getUri()
Get the algorithm uri- Specified by:
getUriin interfaceUriBasedEnum- Returns:
- the algorithm uri
-
getSaltLength
public int getSaltLength()
Get the salt length (PSS)- Returns:
- the salt length
-
getMessageDigest
public MessageDigest getMessageDigest() throws NoSuchAlgorithmException
Get a new instance of MessageDigest for the current digestAlgorithm- Returns:
- an instance of MessageDigest
- Throws:
NoSuchAlgorithmException
-
getMessageDigest
public MessageDigest getMessageDigest(Provider provider) throws NoSuchAlgorithmException
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
-
-