Package com.ongres.scram.common
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 respectiveMessageDigest
andMac
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.Mac
getMacInstance()
Gets a constructedMac
instance, according to the algorithm of the SCRAM mechanism.MessageDigest
getMessageDigestInstance()
Gets a constructedMessageDigest
instance, 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 MechanismsSecretKeyFactory
secretKeyFactory()
Gets a SecretKeyFactory for the given algorithm.SecretKeySpec
secretKeySpec(byte[] key)
Generates a key of the algorith used, based on the key given.boolean
supportsChannelBinding()
Whether this mechanism supports channel binding
-
-
-
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
-
getMessageDigestInstance
MessageDigest getMessageDigestInstance() throws RuntimeException
Gets a constructedMessageDigest
instance, according to the algorithm of the SCRAM mechanism.- Returns:
- The MessageDigest instance
- Throws:
RuntimeException
- If the MessageDigest instance of the algorithm is not provided by current JVM
-
getMacInstance
Mac getMacInstance() throws RuntimeException
Gets a constructedMac
instance, according to the algorithm of the SCRAM mechanism.- Returns:
- The Mac instance
- Throws:
RuntimeException
- If the Mac instance of the algorithm is not provided by current JVM
-
secretKeySpec
SecretKeySpec secretKeySpec(byte[] key)
Generates a key of the algorith used, based on the key given.- Parameters:
key
- The bytes of the key to use- Returns:
- The instance of SecretKeySpec
-
secretKeyFactory
SecretKeyFactory secretKeyFactory()
Gets a SecretKeyFactory for the given algorithm.- Returns:
- The SecretKeyFactory
-
algorithmKeyLength
int algorithmKeyLength()
Returns the length of the key length of the algorithm.- Returns:
- The length (in bits)
-
supportsChannelBinding
boolean supportsChannelBinding()
Whether this mechanism supports channel binding- Returns:
- True if it supports channel binding, false otherwise
-
-