ScramSha256Authenticator
Runs the SCRAM-SHA-256 exchange of RFC 7677, with or without the channel binding of RFC 5802.
The two mechanisms are one piece of code because they differ in exactly two places: the name sent to the server, and what goes into the c= attribute of the client-final-message.
Functions
Link copied to clipboard
fun authenticate(stream: PgStream, password: String?, mechanisms: List<String>, channelBinding: ChannelBinding): Boolean
Authenticates over stream using whichever of the two mechanisms mechanisms and channelBinding between them allow.
Link copied to clipboard
fun computeSignatures(password: String, salt: ByteArray, iterations: Int, clientFirstMessageBare: String, serverFirstMessage: String, clientFinalMessageWithoutProof: String): ScramSha256Authenticator.ScramResult
Computes the client proof and expected server signature for SCRAM authentication.
Link copied to clipboard
Generates a random base64-encoded string to be used as a client nonce. Non-alphanumeric characters are removed.