Top Description Fields Constructors Methods
com.ongres.scram.common.message

public Class ServerFirstMessage

extends Object
implements StringWritable
Class Inheritance
All Implemented Interfaces
com.ongres.scram.common.util.StringWritable
Imports
com.ongres.scram.common.ScramAttributeValue, .ScramAttributes, com.ongres.scram.common.exception.ScramParseException, com.ongres.scram.common.util.StringWritable, .StringWritableCsv

Constructs and parses server-first-messages. Formal syntax is: server-first-message = [reserved-mext ","] nonce "," salt "," iteration-count ["," extensions] Note that extensions are not supported.
See Also
[RFC5802] Section 7

Field Summary

Modifier and TypeField and Description
private final String
private final int
public static final int
ITERATION_MIN_VALUE

Minimum allowed value for the iteration, as per the RFC.

private final String
private final String

Constructor Summary

AccessConstructor and Description
public
ServerFirstMessage(String
String representing the client-first-message
clientNonce
,
String
Server serverNonce
serverNonce
,
String
The salt
salt
,
int
The iteration count (must be <= 4096)
iteration
)

Constructs a server-first-message from a client-first-message and the additional required data.

Method Summary

Modifier and TypeMethod and Description
public String
public int
public String
public String
public String
public static ServerFirstMessage

Returns:

The parsed instance
parseFrom
(String
The string representing the server-first-message
serverFirstMessage
,
String
The serverNonce that is present in the client-first-message
clientNonce
)

Parses a server-first-message from a String.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public StringBuffer
writeTo(StringBuffer
Where to write the data.
sb
)

Implements com.ongres.scram.common.util.StringWritable.writeTo.

Write the class information to the given StringBuffer.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

clientNonceback to summary
private final String clientNonce
iterationback to summary
private final int iteration
ITERATION_MIN_VALUEback to summary
public static final int ITERATION_MIN_VALUE

Minimum allowed value for the iteration, as per the RFC.

saltback to summary
private final String salt
serverNonceback to summary
private final String serverNonce

Constructor Detail

ServerFirstMessageback to summary
public ServerFirstMessage(String clientNonce, String serverNonce, String salt, int iteration) throws IllegalArgumentException

Constructs a server-first-message from a client-first-message and the additional required data.

Parameters
clientNonce:String

String representing the client-first-message

serverNonce:String

Server serverNonce

salt:String

The salt

iteration:int

The iteration count (must be <= 4096)

Exceptions
IllegalArgumentException:
If clientFirstMessage, serverNonce or salt are null or empty, or iteration < 4096

Method Detail

getClientNonceback to summary
public String getClientNonce()
getIterationback to summary
public int getIteration()
getNonceback to summary
public String getNonce()
getSaltback to summary
public String getSalt()
getServerNonceback to summary
public String getServerNonce()
parseFromback to summary
public static ServerFirstMessage parseFrom(String serverFirstMessage, String clientNonce) throws ScramParseException, IllegalArgumentException

Parses a server-first-message from a String.

Parameters
serverFirstMessage:String

The string representing the server-first-message

clientNonce:String

The serverNonce that is present in the client-first-message

Returns:ServerFirstMessage

The parsed instance

Exceptions
ScramParseException:
If the argument is not a valid server-first-message
IllegalArgumentException:
If either argument is empty or serverFirstMessage is not a valid message
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
writeToback to summary
public StringBuffer writeTo(StringBuffer sb)

Implements com.ongres.scram.common.util.StringWritable.writeTo.

Doc from com.ongres.scram.common.util.StringWritable.writeTo.

Write the class information to the given StringBuffer.

Parameters
sb:StringBuffer

Where to write the data.

Returns:StringBuffer

The same StringBuffer.

Annotations
@Override