ddn.crypto.key.ecdsa
ECDSA Keys and Curve Parameters.
Types 5
Holds the domain parameters for a named elliptic curve.
Curve parameters are accessed via lazy-initialisation functions curveP256, curveP384, and curveP521, each of which returns a ref CurveParams. This avoids both DMD's unreliable static member initialisation and the module-level static this() construction-order problems that caused curve parameters to appear as zero when accessed from other modules' unittests.
Lightweight curve descriptor returned by getCurveDescriptor.
Holds the domain parameters for a named elliptic curve so that curve-agnostic code can look up the prime modulus p, coefficient a, base-point coordinates gx/gy, and order n by name rather than referring to a specific CurveParams instance.
string nameThe standard curve name (e.g. "P-256", "P-384", "P-521").BigInt pThe field prime modulus.BigInt aThe Weierstrass coefficient a (always −3 for NIST P-curves).BigInt bThe Weierstrass coefficient b.BigInt gxThe base-point (generator) x-coordinate.BigInt gyThe base-point (generator) y-coordinate.BigInt nThe order of the base point.Point infinityPoint() staticECDSA Public Key. Represents a point Q = d * G on the curve.
size_t toHash() constECDSA Private Key. Represents the secret multiplier d.
size_t toHash() constFunctions 12
size_t curveFieldLength(string name) @safeReturns the byte length of the curve field element.CurveParams curveP256() ref @trustedReturns the P-256 (secp256r1) curve parameters, initialising on first call. `p = 2^256 − 2^224 + 2^192 + 2^96 − 1`.CurveParams curveP384() ref @trustedReturns the P-384 (secp384r1) curve parameters, initialising on first call. `p = 2^384 − 2^128 − 2^96 + 2^32 − 1`.CurveParams curveP521() ref @trustedReturns the P-521 (secp521r1) curve parameters, initialising on first call. `p = 2^521 − 1` (Mersenne prime).CurveDescriptor getCurveDescriptor(string name) @safeLooks up the domain parameters for a named elliptic curve.ubyte[] encodeEcdsaSpki(ECDSAPublicKey key)Encodes an ECDSA public key as a DER-encoded SubjectPublicKeyInfo (SPKI) per RFC 5480.bool onCurve(BigInt x, BigInt y, CurveDescriptor curve) @trustedDecodes an ECDSA public key from DER-encoded SubjectPublicKeyInfo (SPKI).ECDSAPublicKey decodeEcdsaSpki(const(ubyte)[] der)ubyte[] encodeEcdsaPrivateKey(ECDSAPrivateKey key,
ECDSAPublicKey publicKey = null)Encodes an ECDSA private key in SEC 1 / RFC 5915 format.ECDSAPrivateKey decodeEcdsaPrivateKey(const(ubyte)[] der)Decodes an ECDSA private key from SEC 1 / RFC 5915 format.Variables 7
Object curveLock_ = new Objectbool curveP256Init_bool curveP384Init_bool curveP521Init_