Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrAlreadyStarted = errors.New("instance has already been started") ErrNotStarted = errors.New("instance has not been started") ErrAlreadyFinished = errors.New("instance has already been finished") ErrNotFinished = errors.New("instance has not been finished") ErrVerificationFailed = errors.New("verification failed") )
var DEFAULT_SUITE = CipherSuite[*ed25519.Point, *ed25519.Scalar, *ed25519.Curve]{ Group: new(ed25519.Curve), Hash: sha256.New, PasswordHash: sha512.New, Kdf: hkdf.Key[hash.Hash], Mac: hmac.MAC, }
DEFAULT_SUITE is the default ciphersuite for use in Spake2 Note: sha512 is not Memory-Hard and is not recommended by rfc9382
Functions ¶
This section is empty.
Types ¶
type CipherSuite ¶
type CipherSuite[W Point[W, S], S Scalar[S], G Group[W, S]] struct { Group G Hash func() hash.Hash PasswordHash func() hash.Hash Kdf func(h func() hash.Hash, ikm []byte, salt []byte, info string, L int) ([]byte, error) Mac func(h func() hash.Hash, key, msg []byte) []byte }
CipherSuite is a ciphersuite for the Spake2 protocol
func NewCipherSuite ¶
func NewCipherSuite[W Point[W, S], S Scalar[S], G Group[W, S]]( group G, hash func() hash.Hash, passwordHash func() hash.Hash, kdf func(h func() hash.Hash, ikm, salt []byte, info string, L int) ([]byte, error), mac func(h func() hash.Hash, key, msg []byte) []byte, ) CipherSuite[W, S, G]
Creates a new CipherSuite
type Spake2A ¶
type Spake2A[W Point[W, S], S Scalar[S], G Group[W, S]] struct { // contains filtered or unexported fields }
represents A in the Spake2 protocol
func NewA ¶
func NewA[W Point[W, S], S Scalar[S], G Group[W, S]](pw []byte, A, B string, rand io.Reader, c CipherSuite[W, S, G]) (*Spake2A[W, S, G], error)
Creates a new instance of A pw is a slice of bytes known to both A and B A and B are strings that are shared between A and B
func (*Spake2A[W, S, G]) Finish ¶
Returns thre shared secret key and the confirmation message from the Spake2 protocol Key is the shared secret returned from the protocol Cmsg is the confirmation message to send to B for key confirmation Confirmation if the message to be compared to the message recieved from B for key confirmation
type Spake2B ¶
type Spake2B[W Point[W, S], S Scalar[S], G Group[W, S]] struct { // contains filtered or unexported fields }
Represents B in the Spake2 protocol
func NewB ¶
func NewB[S Scalar[S], W Point[W, S], G Group[W, S]](pw []byte, A string, B string, rand io.Reader, c CipherSuite[W, S, G]) (*Spake2B[W, S, G], error)
Creates a new instance of B pw is a slice of bytes known to both A and B A and B are strings that are shared between A and B
func (*Spake2B[W, S, G]) Finish ¶
Returns thre shared secret key and the confirmation message from the Spake2 protocol Key is the shared secret returned from the protocol Cmsg is the confirmation message to send to A for key confirmation Confirmation if the message to be compared to the message recieved from A for key confirmation