core/crypto/ecdsa

ecdsa

Types

3

Curve

Curve :: enum int { Invalid = 0, SECP256R1 = 1, SECP384R1 = 2, }Source

Curve the curve identifier associated with a given Private_Key or Public_Key

Variables

4

Procedures

19

curve

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

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

sign_asn1

sign_asn1 :: proc(priv_key: ^Private_Key, hash_algo: hash.Algorithm, msg: []u8, allocator: runtime.Allocator, deterministic = !crypto.HAS_RAND_BYTES) -> ([]u8, bool)Source

sign_asn1 returns the signature by priv_key over msg hased using hash_algo using the signing procedure as specified in SEC 1, Version 2.0, Section 4.1.3. ASN.1 DER requires minimal encoding, and the format is clunky and variable-length so for simplicity we allocate the signature.

The signature format is ASN1. SEQUECE { r INTEGER, s INTEGER }`.

sign_raw

sign_raw :: proc(priv_key: ^Private_Key, hash_algo: hash.Algorithm, msg: []u8, sig: []u8, deterministic = !crypto.HAS_RAND_BYTES) -> (bool)Source

sign_raw writes the signature by priv_key over msg hased using hash_algo to sig, using the signing procedure as specified in SEC 1, Version 2.0, Section 4.1.3.

The signature format is r | s.

verify_asn1

verify_asn1 :: proc(pub_key: ^Public_Key, hash_algo: hash.Algorithm, msg: []u8, sig: []u8) -> (bool)Source

verify_asn1 returns true if and only if (⟺) sig is a valid signature by pub_key over msg, hased using hash_algo, per the verification procedure specifed in SEC 1, Version 2.0, Section 4.1.4.

The signature format is ASN.1 SEQUENCE { r INTEGER, s INTEGER }.

verify_raw

verify_raw :: proc(pub_key: ^Public_Key, hash_algo: hash.Algorithm, msg: []u8, sig: []u8) -> (bool)Source

verify_raw returns true if and only if (⟺) sig is a valid signature by pub_key over msg, hased using hash_algo, per the verification procedure specifed in SEC 1, Version 2.0, Section 4.1.4.

The signature format is r | s.

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.