Package com.ongres.scram.common
Interface ScramMechanism
-
- All Known Implementing Classes:
ScramMechanisms
public interface ScramMechanismDefinition of the functionality to be provided by every ScramMechanism. Every ScramMechanism implemented must provide implementations of their respectiveMessageDigestandMacthat 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 intalgorithmKeyLength()Returns the length of the key length of the algorithm.javax.crypto.MacgetMacInstance()Gets a constructedMacinstance, according to the algorithm of the SCRAM mechanism.java.security.MessageDigestgetMessageDigestInstance()Gets a constructedMessageDigestinstance, according to the algorithm of the SCRAM mechanism.java.lang.StringgetName()The name of the mechanism, which must be a value registered under IANA: SASL SCRAM Family Mechanismsjavax.crypto.SecretKeyFactorysecretKeyFactory()Gets a SecretKeyFactory for the given algorithm.javax.crypto.spec.SecretKeySpecsecretKeySpec(byte[] key)Generates a key of the algorith used, based on the key given.booleansupportsChannelBinding()Whether this mechanism supports channel binding
-
-
-
Method Detail
-
getName
java.lang.String getName()
The name of the mechanism, which must be a value registered under IANA: SASL SCRAM Family Mechanisms- Returns:
- The mechanism name
-
getMessageDigestInstance
java.security.MessageDigest getMessageDigestInstance() throws java.lang.RuntimeExceptionGets a constructedMessageDigestinstance, according to the algorithm of the SCRAM mechanism.- Returns:
- The MessageDigest instance
- Throws:
java.lang.RuntimeException- If the MessageDigest instance of the algorithm is not provided by current JVM
-
getMacInstance
javax.crypto.Mac getMacInstance() throws java.lang.RuntimeExceptionGets a constructedMacinstance, according to the algorithm of the SCRAM mechanism.- Returns:
- The Mac instance
- Throws:
java.lang.RuntimeException- If the Mac instance of the algorithm is not provided by current JVM
-
secretKeySpec
javax.crypto.spec.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
javax.crypto.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
-
-