signature: P-256 ECDSA verification, ES256 (slice 3 of #16) #225
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
ECDSA verification over the NIST curve P-256 with SHA-256 (JOSE/COSE
ES256) instd/signature, in TorbScript with no native. It is the algorithm most passkeys sign with, so the registry's WebAuthn slice needs it;std/signaturehas Ed25519 only today.Owner decision (recorded on #16)
Passkeys accept ES256, EdDSA and RS256, with a new pure-TorbScript P-256 ECDSA verifier in
std/signature(new public std surface, no native, no seed change).Pinned records
r || sform), W3C WebAuthn Level 3 section 6.5.6 (an ES256 assertion signature is DERECDSA-Sig-Value)docs/standard-library/signature.mdAcceptance criteria
P256PublicKey(Show,Equals,Hash,TryFrom<String, SignatureError>): from the 65 bytes of an uncompressed SEC 1 point and from its two 32-byte coordinates (COSE key, JWK); both coordinates below p, the point on the curve, refused otherwise (SignatureError.NotAPoint);bytes(),hex().P256Signature: from 64 bytesr || s(JWS) and from strict DER (WebAuthn): oneSEQUENCEof two positive minimalINTEGERs, short-form lengths, no trailing bytes, anything else refused with a reason;randsboth in[1, n - 1], refused otherwise.P256PublicKey.verifies(message, signature)per FIPS 186-5 6.4.2 with SHA-256; a result point at infinity isfalse; both the low-S and the high-S form of a signature verify (FIPS 186-5, WebAuthn and OpenSSL accept both), documented as a pitfall (a signature is malleable, never an identifier).crypto(OpenSSL) in both signature forms, and edge cases from Project Wycheproof (r/s= 0, = n, above n, high S, points not on the curve). Every vector once as accepted and once as refused (changed message, signature or key);torb test std/signature/testsgreen natively and in the VM.docs/standard-library/signature.mddocuments the new types, what is and is not constant time, and the measured speed;skills/regenerated.Seed impact
None: new public types in
std/signaturein plain TorbScript overIntandstd/digest'sSha256; no syntax change, no native, no runtime change, no driver flag, and the compiler looks up none of the new names by string. Additive only.Size and dependencies
One PR, one
feat(std/signature)commit (plus tests and docs). No dependency. Parent: #16; slice 4 (#226, passkeys) depends on it. Security-relevant: architect review of the diff.[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-09T05:30Z (worker of #16, branch
loop/16-p256-verify)