INNER CODE UNIT · Go

InitCurve

schollz/pake · pake.go:228

func InitCurve(pw []byte, role int, curve string) (p *Pake, err error) {
	return initCurveWithOptions(pw, role, curve, nil, nil, false)
}

// InitCurveWithIdentities initializes a PAKE exchange whose session key is
// bound to the ordered identities of party A (role 0) and party B (role 1).
// The identities are copied and are never included in the public wire value.
//
// This method adds targeted participant and application-context binding to
// pake's existing protocol. It does not claim full RFC 9382 conformance.
func InitCurveWithIdentities(pw []byte, role int, curve string, idA, idB []byte) (p *Pake, err error) {
	if role != 0 && role != 1 {
		return nil, fmt.Errorf("role must be 0 (A) or 1 (B)")
	}
	if len(idA) == 0 || len(idB) == 0 {
		return nil, fmt.Errorf("both participant identities are required")
	}
	return initCurveWithOptions(pw, role, curve, idA, idB, true)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…