public class ServerFirstMessage extends java.lang.Object implements StringWritable
server-first-message = [reserved-mext ","] nonce "," salt ","
iteration-count ["," extensions]
Note that extensions are not supported.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
clientNonce |
private int |
iteration |
static int |
ITERATION_MIN_VALUE
Minimum allowed value for the iteration, as per the RFC.
|
private java.lang.String |
salt |
private java.lang.String |
serverNonce |
Constructor and Description |
---|
ServerFirstMessage(java.lang.String clientNonce,
java.lang.String serverNonce,
java.lang.String salt,
int iteration)
Constructs a server-first-message from a client-first-message and the additional required data.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getClientNonce() |
int |
getIteration() |
java.lang.String |
getNonce() |
java.lang.String |
getSalt() |
java.lang.String |
getServerNonce() |
static ServerFirstMessage |
parseFrom(java.lang.String serverFirstMessage,
java.lang.String clientNonce)
Parses a server-first-message from a String.
|
java.lang.String |
toString() |
java.lang.StringBuffer |
writeTo(java.lang.StringBuffer sb)
Write the class information to the given StringBuffer.
|
public static final int ITERATION_MIN_VALUE
private final java.lang.String clientNonce
private final java.lang.String serverNonce
private final java.lang.String salt
private final int iteration
public ServerFirstMessage(java.lang.String clientNonce, java.lang.String serverNonce, java.lang.String salt, int iteration) throws java.lang.IllegalArgumentException
clientNonce
- String representing the client-first-messageserverNonce
- Server serverNoncesalt
- The saltiteration
- The iteration count (must be <= 4096)java.lang.IllegalArgumentException
- If clientFirstMessage, serverNonce or salt are null or empty,
or iteration < 4096public java.lang.String getClientNonce()
public java.lang.String getServerNonce()
public java.lang.String getNonce()
public java.lang.String getSalt()
public int getIteration()
public java.lang.StringBuffer writeTo(java.lang.StringBuffer sb)
StringWritable
writeTo
in interface StringWritable
sb
- Where to write the data.public static ServerFirstMessage parseFrom(java.lang.String serverFirstMessage, java.lang.String clientNonce) throws ScramParseException, java.lang.IllegalArgumentException
serverFirstMessage
- The string representing the server-first-messageclientNonce
- The serverNonce that is present in the client-first-messageScramParseException
- If the argument is not a valid server-first-messagejava.lang.IllegalArgumentException
- If either argument is empty or serverFirstMessage is not a valid messagepublic java.lang.String toString()
toString
in class java.lang.Object