gosrp

package module
v0.0.0-...-5fb65c0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

README

gosrp

Go implementation of the Secure Remote Password Protocol

Documentation

Index

Constants

View Source
const (
	RFC5054_GROUP_1024 = 0
	RFC5054_GROUP_2048 = 1
	RFC5054_GROUP_3072 = 2
	RFC5054_GROUP_4096 = 3
)
View Source
const EPHEMERAL_SECRET_BYTE_LENGTH = 32
View Source
const (
	SALT_LENGTH_IN_BYTES = 4
)

Variables

Functions

func RandRandomFunc

func RandRandomFunc(length int) (random_bytes []byte, err error)

func ScryptKeyDerivation

func ScryptKeyDerivation(salt, username, password []byte) []byte

Types

type CyclicGroup

type CyclicGroup struct {
	Size      int
	Generator *big.Int
	Prime     *big.Int
}
var CyclicGroup_1024 *CyclicGroup = &CyclicGroup{
	Size:      1024,
	Generator: big.NewInt(2),
	Prime:     big.NewInt(0).SetBytes(rfc5054_prime_1024),
}
var CyclicGroup_2048 *CyclicGroup = &CyclicGroup{
	Size:      2048,
	Generator: big.NewInt(2),
	Prime:     new(big.Int).SetBytes(rfc5054_prime_2048),
}
var CyclicGroup_3072 *CyclicGroup = &CyclicGroup{
	Size:      3072,
	Generator: big.NewInt(5),
	Prime:     new(big.Int).SetBytes(rfc5054_prime_3072),
}
var CyclicGroup_4096 *CyclicGroup = &CyclicGroup{
	Size:      4096,
	Generator: big.NewInt(5),
	Prime:     new(big.Int).SetBytes(rfc5054_prime_4096),
}

type HashFunc

type HashFunc func() hash.Hash

type KeyDerivationFunc

type KeyDerivationFunc func(salt, username, password []byte) []byte

type PasswordVerifier

type PasswordVerifier struct {
	Username string
	Salt     []byte
	Verifier []byte
}

type RandomFunc

type RandomFunc func(int) ([]byte, error)

type Srp

type Srp struct {
	Random RandomFunc
	// contains filtered or unexported fields
}

func NewSrp

func NewSrp(cyclicGroup int, hash HashFunc) (*Srp, error)

func NewSrpKDF

func NewSrpKDF(cyclicGroup int, keyDerivationAlgorithm KeyDerivationFunc) (*Srp, error)

func (*Srp) CreateSaltedVerificationKey

func (srp *Srp) CreateSaltedVerificationKey(username string, password []byte) (verifier *PasswordVerifier, err error)

func (*Srp) Hash

func (srp *Srp) Hash(values ...[]byte) []byte

type User

type User struct {
	A *big.Int
	// contains filtered or unexported fields
}

func (*User) Authenticated

func (user *User) Authenticated() bool

func (*User) ProcessChallenge

func (user *User) ProcessChallenge(bytesSalt, bytesB []byte) ([]byte, error)

func (*User) StartAuthentication

func (user *User) StartAuthentication() ([]byte, error)

func (*User) UserName

func (user *User) UserName() string

func (*User) VerifySession

func (user *User) VerifySession(hAMK []byte) error

type Verifier

type Verifier struct {
	A *big.Int
	B *big.Int
	// contains filtered or unexported fields
}

func NewVerifier

func NewVerifier(srp *Srp, passwordVerifier PasswordVerifier) *Verifier

func (*Verifier) Challenge

func (verifier *Verifier) Challenge() (bytesSalt []byte, bytesM []byte, err error)

func (*Verifier) StartAuthentication

func (verifier *Verifier) StartAuthentication(ABytes []byte) error

func (*Verifier) VerifySession

func (verifier *Verifier) VerifySession(MBytes []byte) (hAMK []byte, err error)

Jump to

Keyboard shortcuts

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