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 Detail

      • 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 key
        message - 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