Skip to content

Add W3C test vectors and expand algorithm support#96

Draft
Firehed wants to merge 7 commits intomainfrom
offical-test-vectors
Draft

Add W3C test vectors and expand algorithm support#96
Firehed wants to merge 7 commits intomainfrom
offical-test-vectors

Conversation

@Firehed
Copy link
Owner

@Firehed Firehed commented Feb 3, 2026

Summary

  • Import all 15 W3C WebAuthn Level 3 test vectors (spec section 16) as integration test fixtures
  • Fix packed attestation alg check to only apply to self-attestation (not x5c), per spec §8.2
  • Add ES384 (P-384) and ES512 (P-521) elliptic curve support with SEC 2 v2 curve parameters
  • Add Ed25519 and Ed448 (OKP/EdDSA) support with RFC 8410 PEM formatting
  • Use algorithm-aware OpenSSL digest selection instead of hardcoded SHA-256

Test plan

  • All 15 W3C test vectors pass registration and authentication
  • Full test suite passes with no regressions
  • PHPStan passes at max level (baseline reduced by 4 entries)

🤖 Generated with Claude Code

Firehed and others added 6 commits February 2, 2026 17:40
Import all 15 registration/authentication test vector pairs from
the official W3C WebAuthn Level 3 specification, covering:
- No attestation (ES256, crossOrigin, topOrigin, long credential ID)
- Self attestation (ES256)
- Packed attestation (ES256, ES384, ES512, RS256, Ed25519, Ed448)
- TPM attestation (ES256)
- Android Key attestation (ES256)
- Apple Anonymous attestation (ES256)
- FIDO U2F attestation (ES256)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Uncomment EcdsaSha384 (-35) in COSE Algorithm enum
- Add P384 curve OID, coordinate size, and parameters to COSE Curve
- Generalize EllipticCurve to support variable coordinate sizes
- Add Algorithm::getOpenSslAlgorithm() to map COSE algorithms to
  OpenSSL digest constants
- Fix Packed attestation: only require attStmt.alg == credential
  algorithm for self-attestation (not x5c), per spec §8.2
- Use algorithm-aware digest in GetResponse signature verification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Enable ECDSA with SHA-512 using the P-521 curve, including SEC 2 v2
curve parameters for on-curve validation and algorithm-to-curve mapping.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Enable OctetKeyPair key type with Ed25519 curve for EdDSA signatures.
Adds OKP public key parsing, RFC 8410 PEM formatting, and wires up
the EdDSA algorithm with appropriate OpenSSL verification.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add the fully-specified Ed448 algorithm identifier (COSE -53, RFC 9864
§2.2) and accept it in OKP key parsing alongside the polymorphic EdDSA
identifier.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add the fully-specified Ed448 algorithm identifier (COSE -53, RFC 9864
§2.2) and accept it in OKP key parsing alongside the polymorphic EdDSA
identifier.

Assert decoded CBOR is array in COSEKey, resolving several baselined
PHPStan errors. Add type-narrowing asserts in OctetKeyPair.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 28.23529% with 61 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.00%. Comparing base (971dbab) to head (7424138).

Files with missing lines Patch % Lines
src/PublicKey/OctetKeyPair.php 0.00% 33 Missing ⚠️
src/COSE/Curve.php 29.41% 12 Missing ⚠️
src/COSE/Algorithm.php 0.00% 7 Missing ⚠️
src/PublicKey/EllipticCurve.php 66.66% 6 Missing ⚠️
src/Attestations/Packed.php 66.66% 2 Missing ⚠️
src/COSEKey.php 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #96      +/-   ##
============================================
- Coverage     81.41%   81.00%   -0.41%     
- Complexity      335      367      +32     
============================================
  Files            33       35       +2     
  Lines          1033     1053      +20     
============================================
+ Hits            841      853      +12     
- Misses          192      200       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

All ECDSA curves (ES256, ES384, ES512), EdDSA (Ed25519, Ed448), and
RS256 are now fully supported. Remove stale footnotes referencing
unofficial test vectors and missing algorithm support.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant