ecdsa
nimony/lib/std/crypto/ecdsa.nim
ECDSA signature VERIFICATION over NIST P-256 and P-384 (FIPS 186-5).
These are the two curves certificates and TLS 1.3 CertificateVerify messages are signed with. Verification handles only public values, so the arithmetic is std/crypto/bignum's variable-time Montgomery code.
type Curve = enum P256 = (0, "P256") P384 = (1, "P384")
func dollar`.Curve(e: Curve): stringproc ecdsaVerify(curve: Curve; publicKey: openArray[uint8]; digest: openArray[uint8]; r: openArray[uint8]; s: openArray[uint8]): boolChecks the signature
(r, s)ofdigestunderpublicKey, an uncompressed SEC1 point (04 || X || Y).randsare big-endian integers, leading zeros allowed. The digest is truncated to the order's width, so a SHA-384 digest may be checked against a P-256 key.proc ecdsaVerifyDer(curve: Curve; publicKey: openArray[uint8]; digest: openArray[uint8]; signature: openArray[uint8]): boolecdsaVerifywith the signature in its X.509/TLS encoding,SEQUENCE { INTEGER r, INTEGER s }.