post_quantum_crypto_io library
File-system helpers for post_quantum_crypto (requires dart:io; not
available on the web).
encryptFile/decryptFile: bounded-memory streaming encryption with publish-after-verify semantics.signFile/verifyFile,manifestEntryForFile/verifyManifestFiles.- FileKeyStorage: a directory-backed
KeyStorage.
Classes
- AeadCipher
- An AEAD cipher with fixed key, nonce and tag lengths.
- Argon2idParameters
- Argon2id cost parameters.
- Argon2idPrimitive
- Argon2id (RFC 9106), version 0x13.
- CancellationToken
- Cooperative cancellation for long-running stream and file operations.
- ComposedSymmetricProvider
- A SymmetricProvider that takes the AEADs and SHA-2 from package:cryptography (much faster in pure Dart, and its ChaCha20-Poly1305 works on JavaScript) and HMAC, HKDF and Argon2id from PointyCastle.
- CryptoBackend
-
The set of primitive implementations used by a
PostQuantumCryptoEngine. - DetachedSignature
- A detached signature over some content (object type 0x05).
- EncryptedEnvelope
- A parsed, structurally validated encrypted envelope. Immutable.
- EncryptionKeyPair
- An encryption key pair.
- EncryptionPrivateKey
- A private encryption (KEM) key.
- EncryptionPublicKey
- A public encryption (KEM) key. Immutable.
- EnvelopeRecipient
- Public description of one envelope recipient.
- FileKeyStorage
- KeyStorage in a directory, one file per key.
- HashFunction
- A cryptographic hash function.
- HashSink
- An incremental hash computation.
- HybridKeyEstablishment
- The initiator's output: the message to send and the derived key.
- HybridTranscript
- Data both sides must agree on for the derived keys to match.
- InMemoryKeyStorage
- Process-memory storage (tests, caches). Contents are lost on exit.
- Kdf
- HKDF (RFC 5869) split into its two steps, as HPKE requires.
- KeccakPrimitive
- SHA-3 / SHAKE (FIPS 202) as used by ML-KEM, ML-DSA and X-Wing.
- KemPrimitive
- A FIPS 203 key-encapsulation mechanism (one parameter set).
- KeyId
- A key identifier: a SHA-256 fingerprint of the algorithm and public key.
- KeyMetadata
- Lifecycle metadata attached to a key.
- KeyStorage
- Byte storage for serialized keys.
- KeyStore
- Stores keys with their metadata and implements rotation, revocation and encrypted backup.
- MacFunction
- HMAC over a HashFunction.
- ManifestEntry
- One entry of a SignedManifest.
- PasswordPolicy
- Bounds and defaults for Argon2id password protection (RFC 9106).
- PostQuantumCrypto
- Shortcuts to a default PostQuantumCryptoEngine (pure-Dart backend, SecurityPolicy.standard).
- PostQuantumCryptoEngine
- The configurable entry point of the library.
- PostQuantumProvider
- Post-quantum primitives (ML-KEM, ML-DSA, SLH-DSA).
- QuantumKey
- Any key handled by this package: EncryptionPublicKey, EncryptionPrivateKey, SigningPublicKey or SigningPrivateKey.
- ResourceLimits
- Size, count and allocation limits applied while encoding and parsing.
- SecureRandomSource
- A source of cryptographically secure random bytes.
- SecurityPolicy
- Application security policy.
- SignaturePrimitive
- A FIPS 204 / FIPS 205 signature scheme (one parameter set).
- SignedArtifact
- Content together with its detached signature (object type 0x04).
- SignedManifest
- A signed list of files with sizes and SHA-384 digests (object type 0x06).
- SigningKeyPair
- A signing key pair.
- SigningPrivateKey
- A private signing key. toString never prints key material.
- SigningPublicKey
- A public signing key. Immutable.
- StreamHeader
- Parsed stream header.
- SymmetricProvider
- Symmetric primitives (hashes, HMAC, HKDF, AEAD, Argon2id).
- SystemSecureRandom
-
The platform CSPRNG exposed by
Random.secure(). - TextEncoding
- Textual transport encodings. Binary serialization stays the canonical representation of every object; these are lossless wrappers around it.
- TrustStore
- A set of signing keys the application trusts.
- VerifiedSignature
- The result of a successful signature verification.
- X25519Primitive
- X25519 (RFC 7748).
Enums
- AeadAlgorithm
- Authenticated-encryption algorithms. id is the HPKE AEAD identifier.
- HashAlgorithm
- Hash functions.
- KdfAlgorithm
- Key-derivation functions. id is the HPKE KDF identifier.
- KemAlgorithm
- Key-encapsulation mechanisms usable for encryption keys.
- KeyUsage
- Operations a key may be used for.
- PrivateKeyDerForm
- Which private-key representation to put into PKCS#8.
- SignatureAlgorithm
- Digital-signature algorithms usable for signing keys.
- TrustDecision
- The outcome of evaluating a verified signer against a TrustStore.
Extensions
- PostQuantumCryptoFiles on PostQuantumCryptoEngine
- File helpers (Dart VM / Flutter native only).
Constants
- defaultStreamChunkSize → const int
- Default plaintext bytes per chunk.
- pointyCastleCryptoBackend → const CryptoBackend
- The same backend with every symmetric primitive taken from PointyCastle. Kept as an alternative (and so the KAT suite exercises both providers). Its ChaCha20-Poly1305 needs 64-bit integers and does not run on JavaScript; its AES-GCM is about ten times slower.
- postQuantumCryptoVersion → const String
-
The version of the
post_quantum_cryptopackage. - standardCryptoBackend → const CryptoBackend
- The default pure-Dart backend:
Properties
- backgroundIsolatesSupported → bool
-
Whether runInBackground really runs off the calling thread.
no setter
Functions
-
runInBackground<
T> (T computation()) → Future< T> -
Runs a CPU-bound
computationoff the current isolate where possible.
Typedefs
- Bytes = Uint8List
- A byte string. All cryptographic APIs in this package use Uint8List.
- ProgressCallback = void Function(int bytesProcessed)
- Receives the number of plaintext bytes processed so far.
- RawEncapsulation = ({Uint8List ciphertext, Uint8List sharedSecret})
- The result of a KEM encapsulation.
- RawKeyPair = ({Uint8List publicKey, Uint8List secretKey})
- A key pair as raw byte strings.
Exceptions / Errors
- ContextMismatchException
- Authenticated context of an encrypted object does not match the values the caller required.
- DecryptionFailedException
- Authenticated decryption failed.
- InvalidInputException
- An argument supplied by the caller is invalid (wrong length, out of range, empty where a value is required, ...).
- InvalidKeyException
- A key is malformed, has the wrong algorithm, fails its consistency checks or is not usable for the requested operation.
- KeyNotFoundException
- No recipient entry, key or record matched the requested key.
- MalformedDataException
- Serialized data is structurally invalid: bad magic, truncated, trailing bytes, impossible lengths or non-canonical encodings.
- OperationCancelledException
-
The operation was cancelled through a
CancellationToken. - PolicyViolationException
-
The configured
SecurityPolicyforbids the operation (prohibited algorithm, expired or revoked key, disallowed key usage, ...). - PostQuantumCryptoException
- Base class of every error raised by this package.
- ResourceLimitExceededException
- An input exceeds a configured size, count or resource limit. Raised before the oversized allocation or expensive computation happens.
- The platform does not provide a cryptographically secure random source. Operations fail closed instead of falling back to a weaker generator.
- SignatureVerificationException
- A signature did not verify.
- UnsupportedAlgorithmException
- An algorithm identifier is unknown or not implemented.
- UnsupportedFormatException
- A serialized object uses a format version or object type that this release does not understand.
- UnsupportedPlatformException
- The current platform lacks a capability required by the operation.