scramsha1

package
v0.0.0-...-777fdcb Latest Latest
Warning

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

Go to latest
Published: May 15, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package scramsha1 implements the client and server portions of RFC5802 (https://tools.ietf.org/html/rfc5802).

Index

Constants

View Source
const MechName = "SCRAM-SHA-1"

ScramSha1 mechanism name.

Variables

This section is empty.

Functions

func GenerateKeys

func GenerateKeys(password string, salt []byte, iterations uint16) (clientKey []byte, storedKey []byte, serverKey []byte)

GenerateKeys generates all the keys needed for the mechanism.

Types

type AuthzVerifier

type AuthzVerifier func(ctx context.Context, username, authz string) error

AuthzVerifier verifies the client's authorization identity.

type ClientMech

type ClientMech struct {
	// contains filtered or unexported fields
}

ClientMech implements the client side portion of SCRAM-SHA-1.

func NewClientMech

func NewClientMech(authz, username, password string, nonceLen uint16, nonceSource io.Reader) *ClientMech

NewClientMech creates a new ClientMech.

func (*ClientMech) Completed

func (m *ClientMech) Completed() bool

Completed indicates if the authentication exchange is complete from the client's perspective.

func (*ClientMech) Next

func (m *ClientMech) Next(ctx context.Context, challenge []byte) ([]byte, error)

Next continues the exchange.

func (*ClientMech) Start

func (m *ClientMech) Start(_ context.Context) (string, []byte, error)

Start initializes the mechanism and begins the authentication exchange.

type ServerMech

type ServerMech struct {
	Authz    string
	Username string
	// contains filtered or unexported fields
}

ServerMech implements the server side portion of SCRAM-SHA-1.

func NewServerMech

func NewServerMech(storedUserProvider StoredUserProvider, verifier AuthzVerifier, nonceLen uint16, nonceSource io.Reader) *ServerMech

NewServerMech creates a new ServerMech.

func (*ServerMech) Completed

func (m *ServerMech) Completed() bool

Completed indicates if the authentication exchange is complete from the server's perspective.

func (*ServerMech) Next

func (m *ServerMech) Next(ctx context.Context, response []byte) ([]byte, error)

Next continues the exchange.

func (*ServerMech) Start

func (m *ServerMech) Start(ctx context.Context, initialResponse []byte) (string, []byte, error)

Start initializes the mechanism and begins the authentication exchange.

type StoredUser

type StoredUser struct {
	Salt       []byte
	Iterations uint16
	StoredKey  []byte
	ServerKey  []byte
}

StoredUser holds the information needed to validate a user.

type StoredUserProvider

type StoredUserProvider func(ctx context.Context, username string) (*StoredUser, error)

StoredUserProvider returns the salt and iteration count for a given user.

Jump to

Keyboard shortcuts

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