srp

package
v0.0.1-0...-29cb976 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeVerifier

func ComputeVerifier(params *Params, salt, identity, password []byte) []byte

ComputeVerifier returns a verifier that is calculated as described in Section 3 of [SRP-RFC]. The verifier (v) is computed based on the salt (s), user name (I), password (P), and group parameters (N, g).

x = H(s | H(I | ":" | P)), v = g^x % N

func GenKey

func GenKey() ([]byte, error)

GenKey generate a random key

Types

type Client

type Client struct {
	Params     *Params
	Multiplier *big.Int
	Secret     *big.Int
	A          *big.Int
	X          *big.Int

	M1 []byte
	M2 []byte
	K  []byte
	// contains filtered or unexported fields
}

func NewClient

func NewClient(params *Params, salt, identity, password, secret []byte) *Client

func (*Client) CheckM2

func (c *Client) CheckM2(M2 []byte) error

func (*Client) ComputeA

func (c *Client) ComputeA() []byte

func (*Client) ComputeK

func (c *Client) ComputeK() []byte

func (*Client) ComputeM1

func (c *Client) ComputeM1() ([]byte, error)

func (*Client) SetB

func (c *Client) SetB(Bb []byte) error

type Params

type Params struct {
	G           *big.Int
	N           *big.Int
	Hash        crypto.Hash
	NLengthBits int
}

Params Map of bits to <G, N> tuple

func GetParams

func GetParams(G int) (*Params, error)

type Server

type Server struct {
	Params   *Params
	Verifier *big.Int
	Secret   *big.Int
	B        *big.Int

	M1 []byte
	M2 []byte
	K  []byte
	// contains filtered or unexported fields
}

func NewServer

func NewServer(params *Params, verifier []byte, secret []byte) *Server

func (*Server) CheckM1

func (s *Server) CheckM1(M1 []byte) ([]byte, error)

func (*Server) ComputeB

func (s *Server) ComputeB() []byte

func (*Server) ComputeK

func (s *Server) ComputeK() []byte

func (*Server) SetA

func (s *Server) SetA(A []byte) error

Jump to

Keyboard shortcuts

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