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

## Class ScramMechanism

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

- All Implemented Interfaces:
    SaslMechanism

      public class ScramMechanism
      extends AbstractSaslMechanism

- - ### Field Summary

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

      `SASL_COMPLETE_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScramMechanism()`
    `ScramMechanism(String mechanismName, String algorithm, byte[] clientKey, byte[] serverKey)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `evaluateChallenge(String input, SessionObject sessionObject)` Evaluating challenge received from server.
    `protected tigase.jaxmpp.core.client.xmpp.modules.auth.scram.ScramMechanism.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 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`

- - ### Constructor Detail

    - #### ScramMechanism

          public ScramMechanism()

    - #### ScramMechanism

          public ScramMechanism(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`

    - #### getData

          protected tigase.jaxmpp.core.client.xmpp.modules.auth.scram.ScramMechanism.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.

    - #### xor

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

Copyright © 2006–2016 Tigase. All rights reserved.