Documentation
¶
Overview ¶
Package spake2plus implements SPAKE2+, the augmented password-authenticated key exchange of RFC 9383, over the NIST curves on filippo.io/nistec.
A Prover (the party that knows the password) and a Verifier (the party that stores the registration record w0, L) exchange one key share each and one confirmation tag each, and end with the same K_shared or with an error.
Point arithmetic is constant time (nistec). Scalar handling is not: w0, w1, x and y are reduced with math/big. The package has not been audited.
Index ¶
- Variables
- type Prover
- type Suite
- func (s *Suite) NewProver(context, idProver, idVerifier, w0, w1 []byte) (*Prover, error)
- func (s *Suite) NewVerifier(context, idProver, idVerifier, w0, L []byte) (*Verifier, error)
- func (s *Suite) Register(w1 []byte) (L []byte, err error)
- func (s *Suite) ScalarLen() int
- func (s *Suite) Scalars(w0s, w1s []byte) (w0, w1 []byte, err error)
- type Verifier
Constants ¶
This section is empty.
Variables ¶
var ( P256SHA256HKDFHMAC = suite("P256-SHA256-HKDF-SHA256-HMAC-SHA256", p256, sha256.New, false, p256M, p256N) P256SHA512HKDFHMAC = suite("P256-SHA512-HKDF-SHA512-HMAC-SHA512", p256, sha512.New, false, p256M, p256N) P384SHA256HKDFHMAC = suite("P384-SHA256-HKDF-SHA256-HMAC-SHA256", p384, sha256.New, false, p384M, p384N) P384SHA512HKDFHMAC = suite("P384-SHA512-HKDF-SHA512-HMAC-SHA512", p384, sha512.New, false, p384M, p384N) P521SHA512HKDFHMAC = suite("P521-SHA512-HKDF-SHA512-HMAC-SHA512", p521, sha512.New, false, p521M, p521N) P256SHA256HKDFCMAC = suite("P256-SHA256-HKDF-SHA256-CMAC-AES-128", p256, sha256.New, true, p256M, p256N) P256SHA512HKDFCMAC = suite("P256-SHA512-HKDF-SHA512-CMAC-AES-128", p256, sha512.New, true, p256M, p256N) )
The seven ciphersuites that RFC 9383 Appendix C provides test vectors for.
var Suites = []*Suite{ P256SHA256HKDFHMAC, P256SHA512HKDFHMAC, P384SHA256HKDFHMAC, P384SHA512HKDFHMAC, P521SHA512HKDFHMAC, P256SHA256HKDFCMAC, P256SHA512HKDFCMAC, }
Suites lists every suite in this package, in RFC 9383 Appendix C order.
Functions ¶
This section is empty.
Types ¶
type Prover ¶
type Prover struct {
// contains filtered or unexported fields
}
Prover is the party that knows the password (w0 and w1).
type Suite ¶
type Suite struct {
// Name is the suite's name as it appears in the RFC's test vectors,
// e.g. "P256-SHA256-HKDF-SHA256-HMAC-SHA256".
Name string
// contains filtered or unexported fields
}
Suite is one SPAKE2+ ciphersuite from RFC 9383 Table 1.
func (*Suite) NewProver ¶
NewProver prepares a Prover. context is the application's customization string (may be empty); idProver and idVerifier are the identities that went into w0 and w1 (either may be empty, see RFC 9383 §3.3 on unknown key-share attacks).
func (*Suite) NewVerifier ¶
NewVerifier prepares a Verifier from the stored record.
func (*Suite) Register ¶
Register computes the registration record L = w1*P that the Verifier stores next to w0. The Verifier never learns w1.
func (*Suite) ScalarLen ¶
ScalarLen is the byte length of w0, w1 and the registration record's scalars for this suite (32, 48 or 66).
func (*Suite) Scalars ¶
Scalars turns the two halves of a password-based KDF output into w0 and w1 (RFC 9383 §3.2): each half is reduced modulo the group order. Each half must be at least ScalarLen()+8 bytes so the reduction bias stays below 2^-64. The choice of KDF, its parameters and the salt are the application's.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
spake2plus
command
Command spake2plus runs a SPAKE2+ (RFC 9383) exchange between an in-process Prover and Verifier and prints every message, so the protocol can be seen end to end without a network peer.
|
Command spake2plus runs a SPAKE2+ (RFC 9383) exchange between an in-process Prover and Verifier and prints every message, so the protocol can be seen end to end without a network peer. |