Repository navigation
In review
Labels
enhancementNew feature or request
Description
Summary
cas-lib's only classical signatures are RSA and Ed25519, and its only key exchange is X25519. The NIST curves are what most protocols and platforms still require: ECDSA P-256 is ES256 (JWT, WebAuthn/passkeys, Apple and Android keystores, AWS KMS), P-384/P-521 are needed for CNSA and FIPS profiles, and secp256k1 is used by Bitcoin and Ethereum. ECDH over the same curves is needed for interop with WebCrypto, TLS and most HSMs.
Upstream
- p256 0.14 — https://github.com/RustCrypto/elliptic-curves/tree/master/p256
- p384 0.14 — https://github.com/RustCrypto/elliptic-curves/tree/master/p384
- p521 0.14 — https://github.com/RustCrypto/elliptic-curves/tree/master/p521
- k256 0.14 — https://github.com/RustCrypto/elliptic-curves/tree/master/k256
- ecdsa 0.17 — https://github.com/RustCrypto/signatures/tree/master/ecdsa
Scope
- ECDSA P-256 / SHA-256 (ES256): keygen, sign, verify
- ECDSA P-384 / SHA-384 (ES384)
- ECDSA P-521 / SHA-512 (ES512)
- ECDSA secp256k1 / SHA-256 (ES256K)
- Signature encodings: fixed-size (IEEE P1363 / JOSE) and ASN.1 DER
- ECDH on P-256, P-384, P-521 and secp256k1
Implementation notes
- Follow the module pattern: trait in
cas_<module>.rs, impl in<algorithm>.rs, declared insrc/lib.rs(no top-level re-exports). - Return
CasResult<T>and never panic (a panic across the FFI boundary is UB); addCasErrorvariants only by appending (stable ABI codes). - Zeroize intermediate secret buffers with
zeroize::Zeroizing; structs holding secrets get a redactingDebugimpl (seesrc/pqc/cas_pqc.rs). - Keys are PEM per the data conventions: PKCS#8 private keys and SPKI public keys (accept SEC1
EC PRIVATE KEYtoo if cheap). - Sign deterministically (RFC 6979). Reject high-S signatures for secp256k1 if a strict mode is offered; document the choice.
- ECDH: validate the peer public key (on-curve, not identity) and return the shared secret in a
Zeroizingbuffer; recommend passing it through HKDF rather than using it as a key. - Put signatures and ECDH in one new module (e.g.
ecc) or split acrosssignatures/key_exchange; follow whichever keeps the trait-per-module pattern.
Tests
- Wycheproof:
ecdsa_secp256r1_sha256_test.json,ecdsa_secp384r1_sha384_test.json,ecdsa_secp521r1_sha512_test.json,ecdsa_secp256k1_sha256_test.json(and the_p1363variants where present),ecdh_secp256r1_test.json,ecdh_secp384r1_test.json,ecdh_secp521r1_test.json,ecdh_secp256k1_test.json. - NIST CAVP ECDSA SigVer / KAS ECC KATs under
tests/data/.
Docs
- Add a complete, runnable
fn main()example for each new API todocs/EXAMPLES.mdand keep its Table of Contents in sync.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
WingZer0o commentedon Nov 27, 2026
Downstream tracking issues: