Skip to main content

post_quantum_crypto 2.0.0 copy "post_quantum_crypto: ^2.0.0" to clipboard
post_quantum_crypto: ^2.0.0 copied to clipboard

High-level post-quantum cryptography for Dart: ML-KEM envelopes, multi-recipient and streaming encryption, ML-DSA signatures, X-Wing hybrid key establishment, Argon2id-protected keys and key managemen [...]

2.0.0 #

Breaking #

  • Wire format 2. Every object now carries format version 2, and objects written by 1.x (format 1) are rejected with UnsupportedFormatException; there is no migration path. Keys can still be moved over as SPKI/PKCS#8 or raw seeds, and key identifiers are unchanged.
  • Key-committing encryption. Envelopes, streams and password objects derive their payload key together with a stored 32-byte commitment, checked before the AEAD opens. A malicious sender can no longer make one multi-recipient envelope or stream decrypt to different plaintexts for different recipients ("invisible salamanders"), and a password object opens under at most one password (no partitioning oracles). See doc/FORMAT_V2.md.
  • Streams no longer carry the 32-byte salt field.
  • Strings with unpaired UTF-16 surrogates are rejected everywhere, passwords and hybrid transcript identities included.

Added #

  • EncryptedEnvelope.formatVersion and StreamHeader.formatVersion.
  • TrustStore.withClock and PostQuantumCryptoEngine.createTrustStore, whose evaluate judges expiry by the engine's policy clock.
  • "Format evolution" rules in doc/FORMATS.md. Every parser checks the format version in one place, so a future format version can keep reading this one behind SecurityPolicy.acceptLegacyFormats.

Tests #

  • A real two-key AES-GCM collision ("invisible salamanders") built with GHASH arithmetic, rejected by the commitment.
  • Format vectors are now test/vectors/post_quantum_crypto_v2.json.

1.0.1 #

Fixed #

  • Key metadata: a label or revocation reason over 4096 UTF-8 bytes is now rejected when written (ResourceLimitExceededException). Before, it was written but could not be read back, making the stored key unrecoverable.
  • Key metadata: a date beyond DateTime's range in a key record raises MalformedDataException instead of a raw RangeError.
  • Strings with unpaired UTF-16 surrogates in fields that are decoded back (authenticated contexts, signed metadata, key labels and revocation reasons, manifest paths) are rejected with InvalidInputException. Before, they were silently encoded as U+FFFD, so two distinct context keys could produce an envelope that no recipient could open, and decoding did not reproduce the input. Passwords and hybrid transcript identities are only hashed and keep the 1.0.0 encoding, so existing data stays readable.
  • KeyStore.get checks that the stored entry holds the requested key (key id, and private vs public); a swapped or misplaced file raises InvalidKeyException instead of returning a different key.
  • FileKeyStorage.delete waits for pending writes of the same key, so a delete issued after a write is no longer undone by that write. An invalid key name fails the returned Future instead of throwing synchronously.
  • Stream decryption opens chunks one at a time as they are emitted, so a large input event no longer holds all its plaintext at once, and onProgress reports each chunk as it is emitted instead of a batch total ahead of time.

Documentation #

  • SECURITY.md: multi-recipient envelopes and streams are not key-committing; SLH-DSA private-key import takes the public key from the secret key.
  • README: file APIs and caller-supplied input streams let their own errors through unchanged.
  • TrustStore.evaluate and decryptFile document their clock and file permission behaviour.

Examples #

  • New example/sharing_and_releases.dart (group sharing with add/remove recipients, password-based encryption, streaming progress, signed manifests and artifacts) and example/key_management.dart (metadata, rotation, revocation, policies, backup/restore, PEM). The README lists every example, and CI runs them all.

CI and tests #

  • Coverage is uploaded to Codecov (codecov/codecov-action@v7); README shows the Codecov badge. actions/checkout upgraded to v7.
  • New tests for DER/PKCS#8 of every signature algorithm, PKCS#8 v2 embedded public keys, stream decryption cancellation and deferred header parsing, and the fixes above.

1.0.0 #

Initial release.

Added #

  • Envelope encryption with ML-KEM-512/768/1024 (FIPS 203) and X-Wing recipients. Each recipient's data key is wrapped with HPKE (RFC 9180, HKDF-SHA-384); the payload uses AES-256-GCM or ChaCha20-Poly1305. Works for one or many recipients.
  • Authenticated context on every encrypted object, with requiredContext checks on decryption.
  • Rewrapping: rewrapEnvelope, addRecipients and removeRecipients re-encrypt under a fresh data key.
  • Streaming encryption (STREAM construction): per-chunk counter and final-flag nonces, progress reporting and cancellation, bounded memory. encryptFile and decryptFile publish their output only after full verification.
  • Signatures: ML-DSA-44/65/87 (FIPS 204) and SLH-DSA-SHAKE (FIPS 205) with context strings. Also detached signatures, signed artifacts, signed manifests, stream and file signing, and TrustStore for trust decisions.
  • Hybrid key establishment with X-Wing and transcript binding.
  • Keys:
    • Seed-form private keys, KeyId fingerprints and lifecycle metadata.
    • Package key records, SPKI and PKCS#8 DER/PEM, interoperable with OpenSSL 3.5+.
    • Argon2id-protected exports and password changes.
    • KeyStore with rotation, revocation and encrypted backup and restore, on InMemoryKeyStorage or FileKeyStorage.
  • Password-based data encryption with Argon2id.
  • SecurityPolicy: allowed and minimum algorithms, hybrid-only mode, resource limits, Argon2id bounds, and key expiry, revocation and usage enforcement.
  • Swappable CryptoBackend: providers for pqcrypto, package:cryptography and PointyCastle.
  • runInBackground: runs work in an isolate on native platforms.
  • Formats: documented in doc/FORMATS.md. All are versioned and strictly parsed.
  • Tests:
    • NIST ACVP (ML-KEM, ML-DSA), Wycheproof, X-Wing draft, HPKE-PQ draft and RFC vectors.
    • OpenSSL interoperability, parser fuzzing, and browser tests on dart2js and dart2wasm.
  • Benchmarks: benchmark/main.dart, with results in doc/BENCHMARKS.md.
1
likes
0
points
1.3k
downloads

Publisher

unverified uploader

Weekly Downloads

High-level post-quantum cryptography for Dart: ML-KEM envelopes, multi-recipient and streaming encryption, ML-DSA signatures, X-Wing hybrid key establishment, Argon2id-protected keys and key management. Pure Dart, built on pqcrypto and PointyCastle behind swappable provider interfaces.

Repository (GitHub)
View/report issues

Topics

#cryptography #post-quantum #encryption #signatures #security

License

unknown (license)

Dependencies

cryptography, meta, pointycastle, pqcrypto

More

Packages that depend on post_quantum_crypto