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 Summary

    Modifier and Type
    Method
    Description
    int
    Returns the length of the key length of the algorithm.
    byte[]
    digest(byte[] message)
    Calculate a message digest, according to the algorithm of the SCRAM mechanism.
    The name of the mechanism, which must be a value registered under IANA: SASL SCRAM Family Mechanisms
    byte[]
    hmac(byte[] key, byte[] message)
    Calculate the hmac of a key and a message, according to the algorithm of the SCRAM mechanism.
    byte[]
    saltedPassword(StringPreparation stringPreparation, String password, byte[] salt, int iteration)
    Compute the salted password
    boolean
    Whether this mechanism supports channel binding
  • Method Details

    • getName

      String getName()
      The name of the mechanism, which must be a value registered under IANA: SASL SCRAM Family Mechanisms
      Returns:
      The mechanism name
    • 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)
    • supportsChannelBinding

      boolean supportsChannelBinding()
      Whether this mechanism supports 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