core/crypto/ecdh

ecdh

Types

3

Curve

Curve :: enum int { Invalid = 0, SECP256R1 = 1, SECP384R1 = 2, X25519 = 3, X448 = 4, }Source

Curve the curve identifier associated with a given Private_Key or Public_Key

Public_Key

Public_Key :: struct { // WARNING: All of the members are to be treated as internal (ie: // the Public_Key structure is intended to be opaque). _curve: Curve, _impl: union { secec.Point_p256r1, secec.Point_p384r1, X25519_Buf, X448_Buf, }, }Source

Public_Key is an ECDH public key.

Variables

4

CURVE_NAMES

CURVE_NAMES :: [5]string = [Curve]string { .Invalid = "Invalid", .SECP256R1 = "secp256r1", .SECP384R1 = "secp384r1", .X25519 = "X25519", .X448 = "X448", }Source

CURVE_NAMES is the Curve to curve name string.

Procedures

17

curve

curve :: proc(k: ^T) -> (Curve)Source

curve returns the Curve used by a Private_Key or Public_Key instance.

ecdh

ecdh :: proc(priv_key: ^Private_Key, pub_key: ^Public_Key, dst: []u8) -> (bool)Source

ecdh performs an Elliptic Curve Diffie-Hellman key exchange betwween the Private_Key and Public_Key, writing the shared secret to dst.

The neutral element is rejected as an error.

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.