Skip to main content

Seeded WebAuthn Credentials: reference implementation

Project description

Reference implementation and test vectors for DiceKey's "Seeding WebAuthN" specification

SEEDing WEbAuthN CrEDentials (weeds out implementation bugs)

Spec: https://github.com/dicekeys/seeding-webauthn.

Contains:

  • keypair_from_seed_mac specifying how to generate the P256 keypairs
  • credential_id_from_seed_nonce_rpidhash, specifying how to serialize credentials
  • validate_credential_id specifying how to verify a received credential ID is valid
  • nonce_extstate_mac_from_credential_id, specifying how to deserialize credential IDs
  • test vectors (can easily adapt, uses independent seeded DRBG)

Does not contain:

  • construction of nonce / unique ID from (seed, rp_id, user_id, entropy) quadruples; this is left to the authenticator implementation by the specification.

The signatures are over b"seedweed".

Conformance testing

Calling seedweed.load_test_vectors(shortlist=True) in the following should be sufficient to hit all the known tricky corner cases.

1. MakeCredential

For all test vectors v in seedweed.load_test_vectors():

  • set v["seed"]
  • call authenticator MC with v["rp_id"] (freely choose user_id and other parameters)
  • extract generated credential_id, public_key, and pass to seedweed.conformance.verify_make_credential together with the attested data that was signed

This test verifies that credential IDs generated by the authenticator can be used by spec-compliant implementations.

2. GetAssertion

For all test vectors v in seedweed.load_test_vectors():

  • set v["seed"]
  • call authenticator GA with v["credential_id"], v["rp_id"] (freely choose user_id and other parameters)
  • pass generated signature with data that was signed to seedweed.conformance.verify_get_assertion

This test verifies that the authenticator can use credential IDs generated by a spec-compliant implementations.

On test vectors

The authenticator has leeway on:

  • how to generate a nonce ("uniqueId") for its credentials
  • whether to include "extState" in its (generated) credential IDs
  • whether to follow RFC 6979, i.e., deterministic signatures

However:

  • given (seed, credentialID), the P256 keypair is determined, and
  • additionally given rpIdHash, appropriate credential binding can be verified

P256 public keys are serialized here as (X, Y) coordinates, each as zero-padded 32 byte big-endian.

Installation

To install, need Python >=3.6, then: pip install seedweed

Once done, there should be a command generate-seedweed-test-vectors you can run that recreates the test vectors. Modifying the Parameters allows generating more test vectors, as needed.

Development

Many ways, one is to make setup and then source venv/bin/activate.

Uses flit for packaging as it seems least-effort (flit build, flit install).

Contributing

Please save files with UNIX-style line endings, and run make check to enforce basic consistency (make fix can automatically fix most issues).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seedweed-1.0rc7.tar.gz (121.3 kB view details)

Uploaded Source

Built Distribution

seedweed-1.0rc7-py2.py3-none-any.whl (117.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file seedweed-1.0rc7.tar.gz.

File metadata

  • Download URL: seedweed-1.0rc7.tar.gz
  • Upload date:
  • Size: 121.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.24.0

File hashes

Hashes for seedweed-1.0rc7.tar.gz
Algorithm Hash digest
SHA256 5dc5b11c0756dc394348787cb38dcfa7e0f3cdced079b64ceabc563f07110a07
MD5 74f10ce15fa5677cc1c12f9db9d08928
BLAKE2b-256 38c16ff0aadc7f9038ade910fccb394f6d252f9b16017d92815ca4a871b8b7d9

See more details on using hashes here.

File details

Details for the file seedweed-1.0rc7-py2.py3-none-any.whl.

File metadata

  • Download URL: seedweed-1.0rc7-py2.py3-none-any.whl
  • Upload date:
  • Size: 117.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.24.0

File hashes

Hashes for seedweed-1.0rc7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f939496056912abf031c2f5333c7e405d8569b891d2cbc023a235593d3274658
MD5 f736e430e87499fc63c96871c7a67b49
BLAKE2b-256 48d5bedf9fda6010ad562fc41a14e9430724caa2087780ee7459b1f1802327fc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page