Class SRP6ScramblingParameter

  • All Implemented Interfaces:
    SRP6IntegerVariable

    public final class SRP6ScramblingParameter
    extends AbstractSRP6IntegerVariable
    SRP-6 Random Scrambling Parameter (u).

    This variable is computed as:

     u = H(A | B)
     
    where H() is a one-way hash function, | a concatenation operator, A client's public key and B the server's public key.
    • Constructor Detail

      • SRP6ScramblingParameter

        public SRP6ScramblingParameter​(ImmutableMessageDigest hashFunction,
                                       SRP6IntegerVariable clientPublicKey,
                                       SRP6IntegerVariable serverPublicKey,
                                       SRP6IntegerVariable prime,
                                       ByteOrder byteOrder)
        Constructs a new SRP-6 Random Scrambling Parameter as specified in RFC 5054.
         u = H(PAD(A) | PAD(B))
         
        Note: A and B are zero-padded to the byte length of N.
        Parameters:
        hashFunction - a one-way hash function - H()
        clientPublicKey - SRP-6 variable: client public key (A)
        serverPublicKey - SRP-6 variable: server public key (B)
        prime - SRP-6 variable: prime (N)
        byteOrder - the byte order to use when converting the resulting hash to integer and the byte order of public keys' byte sequences to feed to the hash function
    • Method Detail

      • bytes

        public Bytes bytes​(ByteOrder preferredOrder)
                    throws IllegalStateException
        Returns this SRP-6 Integer Variable as a byte sequence in the preferred byte order.

        The representation returned must be minimal. That is, all leading (or trailing, depending on the preferredOrder) zero bytes have to be trimmed.

        Number zero is hence defined as an empty byte sequence.

        Parameters:
        preferredOrder - the preferred byte order of the byte sequence that represents this SRP-6 Integer Variable
        Returns:
        the byte sequence that represents this SRP-6 Integer Variable in the preferred byte order
        Throws:
        IllegalStateException - if byte length of N is shorter than the byte length of either A or B