Package org.bouncycastle.crypto.agreement.srp

## Class SRP6Util

- java.lang.Object
- - org.bouncycastle.crypto.agreement.srp.SRP6Util

-     public class SRP6Util
      extends java.lang.Object

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SRP6Util()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static java.math.BigInteger` | `calculateK​(Digest digest, java.math.BigInteger N, java.math.BigInteger g)` |
    `static java.math.BigInteger` | `calculateKey​(Digest digest, java.math.BigInteger N, java.math.BigInteger S)` | Computes the final Key according to the standard routine: Key = H(S)
    `static java.math.BigInteger` | `calculateM1​(Digest digest, java.math.BigInteger N, java.math.BigInteger A, java.math.BigInteger B, java.math.BigInteger S)` | Computes the client evidence message (M1) according to the standard routine: M1 = H( A | B | S )
    `static java.math.BigInteger` | `calculateM2​(Digest digest, java.math.BigInteger N, java.math.BigInteger A, java.math.BigInteger M1, java.math.BigInteger S)` | Computes the server evidence message (M2) according to the standard routine: M2 = H( A | M1 | S )
    `static java.math.BigInteger` | `calculateU​(Digest digest, java.math.BigInteger N, java.math.BigInteger A, java.math.BigInteger B)` |
    `static java.math.BigInteger` | `calculateX​(Digest digest, java.math.BigInteger N, byte[] salt, byte[] identity, byte[] password)` |
    `static java.math.BigInteger` | `generatePrivateValue​(Digest digest, java.math.BigInteger N, java.math.BigInteger g, java.security.SecureRandom random)` |
    `static java.math.BigInteger` | `validatePublicValue​(java.math.BigInteger N, java.math.BigInteger val)` |

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

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

- - ### Constructor Detail

    - #### SRP6Util

          public SRP6Util()

  - ### Method Detail

    - #### calculateK

          public static java.math.BigInteger calculateK​(Digest digest,
                                                        java.math.BigInteger N,
                                                        java.math.BigInteger g)

    - #### calculateU

          public static java.math.BigInteger calculateU​(Digest digest,
                                                        java.math.BigInteger N,
                                                        java.math.BigInteger A,
                                                        java.math.BigInteger B)

    - #### calculateX

          public static java.math.BigInteger calculateX​(Digest digest,
                                                        java.math.BigInteger N,
                                                        byte[] salt,
                                                        byte[] identity,
                                                        byte[] password)

    - #### generatePrivateValue

          public static java.math.BigInteger generatePrivateValue​(Digest digest,
                                                                  java.math.BigInteger N,
                                                                  java.math.BigInteger g,
                                                                  java.security.SecureRandom random)

    - #### validatePublicValue

          public static java.math.BigInteger validatePublicValue​(java.math.BigInteger N,
                                                                 java.math.BigInteger val)
                                                          throws CryptoException

      Throws:
        `CryptoException`

    - #### calculateM1

          public static java.math.BigInteger calculateM1​(Digest digest,
                                                         java.math.BigInteger N,
                                                         java.math.BigInteger A,
                                                         java.math.BigInteger B,
                                                         java.math.BigInteger S)

      Computes the client evidence message (M1) according to the standard routine: M1 = H( A | B | S )
      Parameters:
        `digest` - The Digest used as the hashing function H
        `N` - Modulus used to get the pad length
        `A` - The public client value
        `B` - The public server value
        `S` - The secret calculated by both sides
      Returns:
        M1 The calculated client evidence message

    - #### calculateM2

          public static java.math.BigInteger calculateM2​(Digest digest,
                                                         java.math.BigInteger N,
                                                         java.math.BigInteger A,
                                                         java.math.BigInteger M1,
                                                         java.math.BigInteger S)

      Computes the server evidence message (M2) according to the standard routine: M2 = H( A | M1 | S )
      Parameters:
        `digest` - The Digest used as the hashing function H
        `N` - Modulus used to get the pad length
        `A` - The public client value
        `M1` - The client evidence message
        `S` - The secret calculated by both sides
      Returns:
        M2 The calculated server evidence message

    - #### calculateKey

          public static java.math.BigInteger calculateKey​(Digest digest,
                                                          java.math.BigInteger N,
                                                          java.math.BigInteger S)

      Computes the final Key according to the standard routine: Key = H(S)
      Parameters:
        `digest` - The Digest used as the hashing function H
        `N` - Modulus used to get the pad length
        `S` - The secret calculated by both sides
      Returns:
        the final Key value.