tigase.jaxmpp.core.client.xmpp.modules.auth.scram

## Class AbstractScram

- java.lang.Object
- - tigase.jaxmpp.core.client.xmpp.modules.auth.saslmechanisms.AbstractSaslMechanism
  - - tigase.jaxmpp.core.client.xmpp.modules.auth.scram.AbstractScram

- All Implemented Interfaces:
    SaslMechanism
  Direct Known Subclasses:
    ScramMechanism, ScramPlusMechanism, ScramSHA256Mechanism, ScramSHA512Mechanism

      public abstract class AbstractScram
      extends AbstractSaslMechanism

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AbstractScram.BindType`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static Charset` | `UTF_CHARSET`

    - ### Fields inherited from class tigase.jaxmpp.core.client.xmpp.modules.auth.saslmechanisms.AbstractSaslMechanism

      `SASL_COMPLETE_KEY`

    - ### Fields inherited from interface tigase.jaxmpp.core.client.xmpp.modules.auth.SaslMechanism

      `FORCE_AUTHZID`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractScram(String mechanismName, String algorithm, byte[] clientKey, byte[] serverKey)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `evaluateChallenge(String input, SessionObject sessionObject)` Evaluating challenge received from server.
    `protected abstract byte[]` | `getBindData(AbstractScram.BindType bindType, SessionObject sessionObject)`
    `protected abstract AbstractScram.BindType` | `getBindType(SessionObject sessionObject)`
    `protected tigase.jaxmpp.core.client.xmpp.modules.auth.scram.AbstractScram.Data` | `getData(SessionObject sessionObject)`
    `protected byte[]` | `h(byte[] data)`
    `static byte[]` | `hi(String algorithm, byte[] password, byte[] salt, int iterations)`
    `protected static byte[]` | `hmac(SecretKey key, byte[] data)`
    `boolean` | `isAllowedToUse(SessionObject sessionObject)` This method is used to check if mechanism can be used with current session.
    `protected SecretKey` | `key(byte[] key)`
    `String` | `name()` Return mechanism name.
    `static byte[]` | `normalize(String str)`
    `protected String` | `randomString()`
    `protected byte[]` | `xor(byte[] a, byte[] b)`

    - ### Methods inherited from class tigase.jaxmpp.core.client.xmpp.modules.auth.saslmechanisms.AbstractSaslMechanism

      `isComplete, setComplete`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### UTF_CHARSET

          protected static final Charset UTF_CHARSET

  - ### Constructor Detail

    - #### AbstractScram

          protected AbstractScram(String mechanismName,
                                  String algorithm,
                                  byte[] clientKey,
                                  byte[] serverKey)

  - ### Method Detail

    - #### hi

          public static byte[] hi(String algorithm,
                                  byte[] password,
                                  byte[] salt,
                                  int iterations)
                           throws InvalidKeyException,
                                  NoSuchAlgorithmException

      Throws:
        `InvalidKeyException`
        `NoSuchAlgorithmException`

    - #### hmac

          protected static byte[] hmac(SecretKey key,
                                       byte[] data)
                                throws NoSuchAlgorithmException,
                                       InvalidKeyException

      Throws:
        `NoSuchAlgorithmException`
        `InvalidKeyException`

    - #### normalize

          public static byte[] normalize(String str)

    - #### evaluateChallenge

          public String evaluateChallenge(String input,
                                          SessionObject sessionObject)
                                   throws ClientSaslException

      Description copied from interface: `SaslMechanism`
      Evaluating challenge received from server.
      Parameters:
        `input` - received data
        `sessionObject` - current SessionObject
      Returns:
        calculated response
      Throws:
        `ClientSaslException`

    - #### getBindData

          protected abstract byte[] getBindData(AbstractScram.BindType bindType,
                                                SessionObject sessionObject)

    - #### getBindType

          protected abstract AbstractScram.BindType getBindType(SessionObject sessionObject)

    - #### getData

          protected tigase.jaxmpp.core.client.xmpp.modules.auth.scram.AbstractScram.Data getData(SessionObject sessionObject)

    - #### h

          protected byte[] h(byte[] data)
                      throws NoSuchAlgorithmException

      Throws:
        `NoSuchAlgorithmException`

    - #### isAllowedToUse

          public boolean isAllowedToUse(SessionObject sessionObject)

      Description copied from interface: `SaslMechanism`
      This method is used to check if mechanism can be used with current session. For example if no username and passowrd is stored in sessionObject, then PlainMechanism can't be used.
      Parameters:
        `sessionObject` - current SessionObject
      Returns:
        `true` if mechanism can be used it current XMPP session.

    - #### key

          protected SecretKey key(byte[] key)

    - #### name

          public String name()

      Description copied from interface: `SaslMechanism`
      Return mechanism name.
      Returns:
        mechanism name.

    - #### randomString

          protected String randomString()

    - #### xor

          protected byte[] xor(byte[] a,
                               byte[] b)

Copyright © 2006–2023 Tigase. All rights reserved.