ddn.crypto.signature.ecdsa
ECDSA (Elliptic Curve Digital Signature Algorithm) Implementation (FIPS 186-4).
Constant-Time Implementation: This module uses constant-time scalar multiplication to prevent timing side-channel attacks. The point multiplication executes in constant time regardless of the scalar value.
struct JPoint
Types 4
classECDSASigner : Signer
Methods
void initialize(PrivateKey key)void init(PrivateKey key)void update(const(ubyte)[] input)ubyte[] sign()Constructors
this(HashFactory hashFactory, Random rng)classECDSAVerifier : Verifier
Methods
void initialize(PublicKey key)void update(const(ubyte)[] input)bool verify(const(ubyte)[] signature)Constructors
this(HashFactory hashFactory)classDeterministicECDSASigner : Signer
Deterministic ECDSA signer using RFC 6979 nonce generation.
This signer produces reproducible signatures without requiring a random number generator. The nonce k is derived deterministically from the private key and the message hash using HMAC-DRBG as specified in RFC 6979.
This is useful for:
- Test reproducibility and known-answer verification
- Environments where RNG quality is uncertain
- Avoiding catastrophic nonce-reuse failures
Methods
void initialize(PrivateKey key)void init(PrivateKey key)void update(const(ubyte)[] input)ubyte[] sign()Signs the accumulated message using RFC 6979 deterministic nonce.Constructors
this(HashFactory hashFactory)Constructs a deterministic ECDSA signer.Functions 8
fn
JPoint jacobianDouble(JPoint P, BigInt mod, BigInt a)fn
Point affineFromJacobian(JPoint P, BigInt mod)fn
JPoint toJacobian(Point P)fn
Point pointMul(Point P, BigInt k, BigInt mod, BigInt a)Constant-time scalar multiplication using double-and-add-always.fn
JPoint ctSelectJPoint(uint condition, JPoint a, JPoint b) pure nothrow @safeConstant-time Jacobian point selection.fn
ECDSAPublicKey ecdsaPublicFromPrivate(ECDSAPrivateKey key)Derives the ECDSA public key from a private scalar.