srp

package
v0.0.0-...-68155bd Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 8 Imported by: 0

README

srp

Module for implementing Secure Remote Password (SRP-6a).

This software is provided as-is, without any warranty of correctness or merchantability. I created it to make my life a little easier for my own personal projects. Use at your own peril! If you happen to find it useful, please fork it, as anything may change at any time whenever I feel like it!

Types

  • Grouper (interface)

    • String() string
    • Bits() int
    • G() *big.Int
    • N() *big.Int
    • Verifier() Verifier
  • Seeder (interface)

    • Bytes(r []byte)
  • KDF (interface)

    • Derive(b, s []byte, keylen uint32) []byte
    • Parms() string
  • Verifier (interface)

    • Group(g Grouper) Verifier
    • Seed(s Seeder) Verifier
    • SeedSize(s uint8) Verifier
    • KDF(k KDF) Verifier
    • Create(user, pass string) string

Variables

  • Argon2id (KDF)

  • ErrSRPBadStatus (error)

Functions

  • func NewGroup(bits int) Grouper

  • func NewSeeder() Seeder

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Argon2id is the Argon2id key derivation function
	Argon2id = newArgon2di(1, 16, 4)
)
View Source
var (
	// ErrSRPBadStatus is returned when the wrong SRP-6a protocol function is called for the current status
	ErrSRPBadStatus = fmt.Errorf("SRP-6a protocol invalid status")
)
View Source
var Seed = NewSeeder()

Seed is the global function to generate cryptographically strong random bytes

Functions

This section is empty.

Types

type Grouper

type Grouper interface {
	fmt.Stringer

	Bits() int
	G() *big.Int
	N() *big.Int

	Verifier() Verifier
}

Grouper is the interface for an SRP group

func NewGroup

func NewGroup(bits int) Grouper

NewGroup creates a new SRP group

type KDF

type KDF interface {
	Derive(b, s []byte, keylen uint32) []byte
	Parms() string
}

KDF is the interface for a key derivation function

type SRP

type SRP interface {
	Bits(bits int) SRP
	Seed(seed Seeder) SRP

	GetBits() int

	ClientInitC(user, pass string, data []byte) ([]byte, error)
}

SRP is the interface to handle the SRP-6a protocol

func NewSRP

func NewSRP() SRP

NewSRP creates a new SRP-6a interface with 2048 bit group as default

type Seeder

type Seeder interface {
	Bytes(r []byte)
}

Seeder is the interface to generate cryptographically strong random bytes

func NewSeeder

func NewSeeder() Seeder

NewSeeder creates a new Seeder interface

type Verifier

type Verifier interface {
	Group(g Grouper) Verifier
	Seed(s Seeder) Verifier
	SeedSize(s uint8) Verifier
	KDF(k KDF) Verifier

	Create(user, pass string) string
}

Verifier is the interface to create SRP-6a verifiers

Jump to

Keyboard shortcuts

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