Package com.ongres.scram.client
Class ScramSession.ClientFinalProcessor
- java.lang.Object
-
- com.ongres.scram.client.ScramSession.ClientFinalProcessor
-
- Enclosing class:
- ScramSession
public class ScramSession.ClientFinalProcessor extends java.lang.Object
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 eitherScramSession.ServerFirstProcessor.clientFinalProcessor(String)
orScramSession.ServerFirstProcessor.clientFinalProcessor(byte[], byte[])
.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
authMessage
private byte[]
clientKey
private java.lang.String
nonce
private byte[]
serverKey
private byte[]
storedKey
-
Constructor Summary
Constructors Modifier Constructor Description private
ClientFinalProcessor(java.lang.String nonce, byte[] saltedPassword)
private
ClientFinalProcessor(java.lang.String nonce, byte[] clientKey, byte[] serverKey)
private
ClientFinalProcessor(java.lang.String nonce, byte[] clientKey, byte[] storedKey, byte[] serverKey)
private
ClientFinalProcessor(java.lang.String nonce, java.lang.String password, java.lang.String salt, int iteration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
clientFinalMessage()
Generates the SCRAM representation of the client-final-message.private java.lang.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(java.lang.String serverFinalMessage)
Receive and process the server-final-message.
-
-
-
Constructor Detail
-
ClientFinalProcessor
private ClientFinalProcessor(java.lang.String nonce, byte[] clientKey, byte[] storedKey, byte[] serverKey)
-
ClientFinalProcessor
private ClientFinalProcessor(java.lang.String nonce, byte[] clientKey, byte[] serverKey)
-
ClientFinalProcessor
private ClientFinalProcessor(java.lang.String nonce, byte[] saltedPassword)
-
ClientFinalProcessor
private ClientFinalProcessor(java.lang.String nonce, java.lang.String password, java.lang.String salt, int iteration)
-
-
Method Detail
-
generateAndCacheAuthMessage
private void generateAndCacheAuthMessage(byte[] cbindData)
-
clientFinalMessage
private java.lang.String clientFinalMessage(byte[] cbindData) throws java.lang.IllegalArgumentException
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:
java.lang.IllegalArgumentException
- If the channel binding data is null
-
clientFinalMessage
public java.lang.String clientFinalMessage()
Generates the SCRAM representation of the client-final-message.- Returns:
- The message
-
receiveServerFinalMessage
public void receiveServerFinalMessage(java.lang.String serverFinalMessage) throws ScramParseException, ScramServerErrorException, ScramInvalidServerSignatureException, java.lang.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 errorjava.lang.IllegalArgumentException
- If the message is null or emptyScramInvalidServerSignatureException
-
-