libgosrp

package module
v0.0.0-...-2e70111 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2014 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

The go-srp/srpserver package contains server-side utilities necessary to implement SRP v. 6a, as described here: http://srp.stanford.edu/design.html It aims to be a generalized implementation for use with various hash functions and key/salt sizes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func H

func H(to_hash, salt []byte) big.Int

example hash function

func Pad

func Pad(length int, src []byte) []byte

func RandomBytes

func RandomBytes(slen uint) (big.Int, error)

Creates an entirely random salt of length slen. For use with Create, if you only need to specify a hash function.

Types

type ChallengeResponse

type ChallengeResponse struct {
	Salt string
	B    string
}

type EmptyUsernameError

type EmptyUsernameError int

func (*EmptyUsernameError) Error

func (e *EmptyUsernameError) Error() string

type ErrNoPrimeAvailable

type ErrNoPrimeAvailable int

func (ErrNoPrimeAvailable) Error

func (e ErrNoPrimeAvailable) Error() string

type ErrorShortBytes

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

func (ErrorShortBytes) Error

func (e ErrorShortBytes) Error() string

type ErrorUninitializedSRPConfig

type ErrorUninitializedSRPConfig string

func (ErrorUninitializedSRPConfig) Error

type SRPClientSession

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

func (*SRPClientSession) New

func (s *SRPClientSession) New(i string, config *SRPConfig) (*SRPClientSession, error)

type SRPConfig

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

func (*SRPConfig) New

func (s *SRPConfig) New(srpgp SRPGroupParameters, hash func([]byte, []byte) big.Int, salt_gen func(uint) (big.Int, error)) *SRPConfig

func (*SRPConfig) SetPad

func (s *SRPConfig) SetPad(value bool)

type SRPGroupParameters

type SRPGroupParameters struct {
	N big.Int
	G big.Int
}

func GetGroupParameters

func GetGroupParameters(Nsize int) (SRPGroupParameters, error)

Takes the size in bits of the desired prime number, and returns an SRPGroupParameters object with the prime and the generator.

type SRPSession

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

func (*SRPSession) ChallengeResponse

func (s *SRPSession) ChallengeResponse() (string, error)

func (*SRPSession) New

func (s *SRPSession) New(v Verifier, config *SRPConfig) (*SRPSession, error)

func (*SRPSession) ReadChallenge

func (s *SRPSession) ReadChallenge(jsonIA string) error

type Verifier

type Verifier struct {
	I        string  //Username
	Salt     big.Int //salt
	Verifier big.Int //verifier
}

func (*Verifier) New

func (v *Verifier) New(user, p string, slen uint, server *SRPConfig) (*Verifier, error)

Create an SRP verifier, given a password p, and the length of the desired salt, a hash function, and a salt generating function. This is the DIY version of Verifier.New() Note: does NOT take a function that generates a hash.Hash, because this would preclude doing things like pbkdf2, which takes the password and salt and deals with them separately. The function handed to this should be a wrapper function that takes the password and salt as its 1st and 2nd argument respectively.

Jump to

Keyboard shortcuts

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