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 MessageDigest and Mac that will not throw a RuntimeException on any JVM, to guarantee true portability of this library.
    • Method Detail

      • getMessageDigestInstance

        MessageDigest getMessageDigestInstance()
                                        throws RuntimeException
        Gets a constructed MessageDigest 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 constructed Mac 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