Package com.ongres.scram.client
Class ScramSession.ClientFinalProcessor
java.lang.Object
com.ongres.scram.client.ScramSession.ClientFinalProcessor
- Enclosing class:
- ScramSession
Processor that allows to generate the client-final-message,
as well as process the server-final-message and verify server's signature.
Generate the processor by calling either
ScramSession.ServerFirstProcessor.clientFinalProcessor(String)
or ScramSession.ServerFirstProcessor.clientFinalProcessor(byte[], byte[])
.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
ClientFinalProcessor
(String nonce, byte[] saltedPassword) private
ClientFinalProcessor
(String nonce, byte[] clientKey, byte[] serverKey) private
ClientFinalProcessor
(String nonce, byte[] clientKey, byte[] storedKey, byte[] serverKey) private
ClientFinalProcessor
(String nonce, String password, String salt, int iteration) -
Method Summary
Modifier and TypeMethodDescriptionGenerates the SCRAM representation of the client-final-message.private String
clientFinalMessage
(byte[] cbindData) Generates the SCRAM representation of the client-final-message, including the given channel-binding data.private void
generateAndCacheAuthMessage
(byte[] cbindData) void
receiveServerFinalMessage
(String serverFinalMessage) Receive and process the server-final-message.
-
Field Details
-
nonce
-
clientKey
private final byte[] clientKey -
storedKey
private final byte[] storedKey -
serverKey
private final byte[] serverKey -
authMessage
-
-
Constructor Details
-
ClientFinalProcessor
-
ClientFinalProcessor
-
ClientFinalProcessor
-
ClientFinalProcessor
-
-
Method Details
-
generateAndCacheAuthMessage
private void generateAndCacheAuthMessage(byte[] cbindData) -
clientFinalMessage
Generates the SCRAM representation of the client-final-message, including the given channel-binding data.- Parameters:
cbindData
- The bytes of the channel-binding data- Returns:
- The message
- Throws:
IllegalArgumentException
- If the channel binding data is null
-
clientFinalMessage
Generates the SCRAM representation of the client-final-message.- Returns:
- The message
-
receiveServerFinalMessage
public void receiveServerFinalMessage(String serverFinalMessage) throws ScramParseException, ScramServerErrorException, ScramInvalidServerSignatureException, IllegalArgumentException Receive and process the server-final-message. Server SCRAM signatures is verified.- Parameters:
serverFinalMessage
- The received server-final-message- Throws:
ScramParseException
- If the message is not a valid server-final-messageScramServerErrorException
- If the server-final-message contained an errorIllegalArgumentException
- If the message is null or emptyScramInvalidServerSignatureException
-