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 Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int algorithmKeyLength()
      Returns the length of the key length of the algorithm.
      javax.crypto.Mac getMacInstance()
      Gets a constructed Mac instance, according to the algorithm of the SCRAM mechanism.
      java.security.MessageDigest getMessageDigestInstance()
      Gets a constructed MessageDigest instance, according to the algorithm of the SCRAM mechanism.
      java.lang.String getName()
      The name of the mechanism, which must be a value registered under IANA: SASL SCRAM Family Mechanisms
      javax.crypto.SecretKeyFactory secretKeyFactory()
      Gets a SecretKeyFactory for the given algorithm.
      javax.crypto.spec.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

        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.RuntimeException
        Gets a constructed MessageDigest instance, 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.RuntimeException
        Gets a constructed Mac instance, 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