public enum ScramMechanisms extends Enum<ScramMechanisms> implements ScramMechanism
MessageDigest: "Every implementation of the Java platform is required to support the
following standard MessageDigest algorithms: MD5, SHA-1, SHA-256".
Mac: "Every implementation of the Java platform is required to support the following
standard Mac algorithms: HmacMD5, HmacSHA1, HmacSHA256".| Enum Constant and Description |
|---|
SCRAM_SHA_1 |
SCRAM_SHA_1_PLUS |
SCRAM_SHA_256 |
SCRAM_SHA_256_PLUS |
| Modifier and Type | Method and Description |
|---|---|
int |
algorithmKeyLength()
Returns the length of the key length of the algorithm.
|
static ScramMechanisms |
byName(String name)
Gets a SCRAM mechanism, given its standard IANA name.
|
byte[] |
digest(byte[] message)
Calculate a message digest, according to the algorithm of the SCRAM mechanism.
|
protected String |
getHashAlgorithmName()
Method that returns the name of the hash algorithm.
|
protected String |
getHmacAlgorithmName()
Method that returns the name of the HMAC algorithm.
|
String |
getName()
The name of the mechanism, which must be a value registered under IANA:
SASL SCRAM Family Mechanisms
|
byte[] |
hmac(byte[] key,
byte[] message)
Calculate the hmac of a key and a message, according to the algorithm of the SCRAM mechanism.
|
byte[] |
saltedPassword(StringPreparation stringPreparation,
String password,
byte[] salt,
int iterations)
Compute the salted password
|
static ScramMechanism |
selectMatchingMechanism(boolean channelBinding,
String... peerMechanisms)
This class classifies SCRAM mechanisms by two properties: whether they support channel binding;
and a priority, which is higher for safer algorithms (like SHA-256 vs SHA-1).
|
boolean |
supportsChannelBinding()
Whether this mechanism supports channel binding
|
static ScramMechanisms |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ScramMechanisms[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ScramMechanisms SCRAM_SHA_1
public static final ScramMechanisms SCRAM_SHA_1_PLUS
public static final ScramMechanisms SCRAM_SHA_256
public static final ScramMechanisms SCRAM_SHA_256_PLUS
public static ScramMechanisms[] values()
for (ScramMechanisms c : ScramMechanisms.values()) System.out.println(c);
public static ScramMechanisms valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullprotected String getHashAlgorithmName()
protected String getHmacAlgorithmName()
public String getName()
ScramMechanismgetName in interface ScramMechanismpublic boolean supportsChannelBinding()
ScramMechanismsupportsChannelBinding in interface ScramMechanismpublic int algorithmKeyLength()
ScramMechanismalgorithmKeyLength in interface ScramMechanismpublic byte[] digest(byte[] message)
ScramMechanismdigest in interface ScramMechanismmessage - the messagepublic byte[] hmac(byte[] key,
byte[] message)
ScramMechanismhmac in interface ScramMechanismkey - the keymessage - the messagepublic byte[] saltedPassword(StringPreparation stringPreparation, String password, byte[] salt, int iterations)
ScramMechanismsaltedPassword in interface ScramMechanismpublic static ScramMechanisms byName(String name)
name - The standard IANA full name of the mechanism.public static ScramMechanism selectMatchingMechanism(boolean channelBinding, String... peerMechanisms)
channelBinding - The type of matching mechanism searched forpeerMechanisms - The mechanisms supported by the other peerCopyright © 2019–2025. All rights reserved.