MCPcopy Index your code
hub / github.com/XTLS/REALITY / generateECDHEKey

Function generateECDHEKey

key_schedule.go:63–70  ·  view source on GitHub ↗

generateECDHEKey returns a PrivateKey that implements Diffie-Hellman according to RFC 8446, Section 4.2.8.2.

(rand io.Reader, curveID CurveID)

Source from the content-addressed store, hash-verified

61// generateECDHEKey returns a PrivateKey that implements Diffie-Hellman
62// according to RFC 8446, Section 4.2.8.2.
63func generateECDHEKey(rand io.Reader, curveID CurveID) (*ecdh.PrivateKey, error) {
64 curve, ok := curveForCurveID(curveID)
65 if !ok {
66 return nil, errors.New("tls: internal error: unsupported curve")
67 }
68
69 return curve.GenerateKey(rand)
70}
71
72func curveForCurveID(id CurveID) (ecdh.Curve, bool) {
73 switch id {

Callers 6

makeClientHelloMethod · 0.85
handshakeMethod · 0.85
processClientHelloMethod · 0.85

Calls 1

curveForCurveIDFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…