scram

package
v2.3.0-beta18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package scram provides functionality for SCRAM authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAuthMessage

func GenerateAuthMessage(firstRequest, firstResponse string, logger *zap.Logger) string

GenerateAuthMessage creates an authentication message based on the initial client request and the server's first response. The function extracts the GS2 header and the client's nonce from the provided strings and then concatenates them to form the complete authentication message.

Parameters:

  • firstRequest: The initial request string from the client.
  • firstResponse: The server's first response string.
  • log: An instance of a log for logging errors and activities.

Returns:

  • A string representing the complete authentication message. If there's an error during extraction or message creation, the function logs the error and returns an empty string.

func GenerateServerFinalMessage

func GenerateServerFinalMessage(authMessage, mechanism, password, salt string, itr int, logger *zap.Logger) (string, error)

GenerateServerFinalMessage generates the server's final message (i.e., the server proof) for SCRAM authentication, using a default password and given authentication message, mechanism, salt, iteration count.

func GenerateServerFirstMessage

func GenerateServerFirstMessage(recordedRequestMsg, recievedRequestMsg, firstResponseMsg []byte, logger *zap.Logger) (string, error)

GenerateServerFirstMessage generates the server's first response message for SCRAM authentication. It replaces the expected nonce from the recorded request with the actual nonce from the received request.

Parameters: - recordedRequestMsg: The byte slice containing the recorded client's first message. - recievedRequestMsg: The byte slice containing the received client's first message. - firstResponseMsg: The byte slice containing the server's initial response message. - log: An instance of a log from the zap package.

Returns: - A modified server's first response message with the nonce replaced. - An error if nonce extraction or replacement fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL