Interface ScramMechanism
-
- All Known Implementing Classes:
ScramMechanisms
public interface ScramMechanism
Definition of the functionality to be provided by every ScramMechanism. Every ScramMechanism implemented must provide implementations of their respective digest and hmac function that will not throw a RuntimeException on any JVM, to guarantee true portability of this library.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
algorithmKeyLength()
Returns the length of the key length of the algorithm.byte[]
digest(byte[] message)
Calculate a message digest, according to the algorithm of the SCRAM mechanism.String
getName()
The name of the mechanism, which must be a value registered under IANA: SASL SCRAM Family Mechanismsbyte[]
hmac(byte[] key, byte[] message)
Calculate the hmac of a key and a message, according to the algorithm of the SCRAM mechanism.boolean
requiresChannelBinding()
Whether this mechanism requires channel bindingbyte[]
saltedPassword(StringPreparation stringPreparation, String password, byte[] salt, int iteration)
Compute the salted password
-
-
-
Method Detail
-
getName
String getName()
The name of the mechanism, which must be a value registered under IANA: SASL SCRAM Family Mechanisms- Returns:
- The mechanism name
-
digest
byte[] digest(byte[] message) throws RuntimeException
Calculate a message digest, according to the algorithm of the SCRAM mechanism.- Parameters:
message
- the message- Returns:
- The calculated message digest
- Throws:
RuntimeException
- If the algorithm is not provided by current JVM or any included implementations
-
hmac
byte[] hmac(byte[] key, byte[] message) throws RuntimeException
Calculate the hmac of a key and a message, according to the algorithm of the SCRAM mechanism.- Parameters:
key
- the keymessage
- the message- Returns:
- The calculated message hmac instance
- Throws:
RuntimeException
- If the algorithm is not provided by current JVM or any included implementations
-
algorithmKeyLength
int algorithmKeyLength()
Returns the length of the key length of the algorithm.- Returns:
- The length (in bits)
-
requiresChannelBinding
boolean requiresChannelBinding()
Whether this mechanism requires channel binding- Returns:
- True if it supports channel binding, false otherwise
-
saltedPassword
byte[] saltedPassword(StringPreparation stringPreparation, String password, byte[] salt, int iteration)
Compute the salted password- Returns:
- The salted password
-
-