pqdga 0.2.0
pqdga: ^0.2.0 copied to clipboard
Defensive-research framework for deterministic domain-generation algorithms, studying how post-quantum primitives change their predictability properties. Lab kit for SOC and IR.
0.2.0 #
Fixed #
The package did not compile. Commit 3d9ba80 ("Use eported libraries and drop
external libraries", 2026-08-11) replaced
import 'package:pqcrypto/pqcrypto.dart' with import 'package:pqforge/pqforge.dart'
across the SLH-DSA checkpoint path and shake_xof.dart.
That commit was right about one thing and wrong about another:
- Right:
pqforgedoes export its own vocabulary —PqKemAlgorithm,PqSignatureAlgorithm,PqSlhDsaAlgorithm,PqKemPrimitives,PqSignaturePrimitives. Importingpqforgeinstead of reaching intopqcrypto/src/is the correct layering for that. - Wrong:
pqforgedoes not re-exportpqcrypto's implementation types. Its barrel says so explicitly: "Lattice primitives and PointyCastle types are not re-exported from this library. Importpackage:pqcrypto/pqcrypto.dart... when you need those APIs directly."
So SlhDsa, SlhDsaParams, Shake128 and Shake256 were undefined, and
dart analyze reported 38 issues including 20+ hard errors. Verified against
the live package: importing only package:pqforge/pqforge.dart leaves all five
symbols undefined, while PqKemAlgorithm, PqSlhDsaAlgorithm,
PqKemPrimitives and PqSignaturePrimitives do resolve.
Restores import 'package:pqcrypto/pqcrypto.dart' in the four affected files
and declares pqcrypto: ^0.4.2 as a direct dependency, since pqdga calls the
FIPS 205 implementation directly and that call is real. pqforge stays
imported wherever its own vocabulary is the right layer.
dart analyze now reports no issues, and the full suite runs: 91 tests pass.
Fixed #
-
secureZerowas ambiguous.pqcryptoexports a symbol of the same name from its ownsrc/common/zeroize.dart, and olderpqforgeversions re-export it. Underpub downgradeboth became visible throughpqforge, so everysecureZerocall site in this package becameAMBIGUOUS_IMPORT— 5 analyzer errors, and 20 lost pub points on the lower-bound check.The
package:zeroizeimport is now prefixed, with a comment explaining why it must stay that way:pqcrypto's implementation is a plain loop with no@pragma('vm:never-inline')and no opaque read anchor, so it is the weaker of the two and must never be the one that wins a name collision.This is the same collision as UQ-2 in
pqkeystore's upstream register: two packages exportsecureZero, and only one of them is DSE-safe.
Added #
SharedSecretLabSession.dispose()— wipeskemSecretKeyandsharedSecret.IdentityBasedLabSession.dispose()— wipessignatureSecretKey.
Both classes hold live private key material in public fields and documented it
as "do not log", but neither offered any way to clear it. kemPublicKey,
kemCiphertext and identityPublicKey are deliberately not wiped: they are
public artifacts.
Changed #
- Replaced the two hand-rolled wipes
(
sessionKey.fillRange(0, sessionKey.length, 0)and the equivalent inMultiRecipientPqdga) withsecureZerofrompackage:zeroize.fillRange(0, n, 0)is exactly the loop that can be optimised away: it carries no@pragma('vm:never-inline')and no opaque read anchor, so Dead Store Elimination can drop the writes in an AOT build.secureZeroisvm:never-inlineand anchors the writes, so it survives. - Added
package:zeroizeas a dependency (pure Dart, one transitive dependency).
Best-effort erasure, not a memory-erasure guarantee: pure Dart cannot stop the GC
from copying a buffer and has no mlock equivalent.
Added #
-
LabKeySink— an optional sink that receives generated key material as a lab session is established.SharedSecretPqdga.labEstablishandIdentityBasedPqdga.labEstablishtake akeySinkargument; every key they generate is handed over with its name, algorithm, and whether it is secret.final session = SharedSecretPqdga.labEstablish( keySink: CallbackLabKeySink( (key) => keystore.put(metadataFor(key), key.bytes, unlock), (count) => print('stored $count keys'), ), );Two implementations:
InMemoryLabKeySinkfor a caller that wants to inspect the keys, andCallbackLabKeySinkas the integration seam.Passing no sink changes nothing and writes nothing anywhere.
-
No filesystem sink, deliberately. pqdga does not write key bytes to disk and offers no API that does. A plaintext key file is a worse custody story than not persisting at all, because it looks durable while being unprotected. Custody belongs to
pqkeystore: wireCallbackLabKeySinktoPqKeystore.putand the key is sealed by the selected provider before it touches storage. The sink is handed the session's own buffers, so it must copy if it needs to keep them — anddispose()still reaches the original.The absence is asserted:
test/lab_key_sink_test.darthas no filesystem test, because there is nothing to test. -
7 tests for the seam, including that a throwing callback aborts establishment rather than silently losing a key, and that a sink receives the same buffer the session later wipes.
Note #
- pubspec
descriptionshortened to 153 characters. It was 271, outside pub.dev's 20-180 scoring window. The full framing of the research programme remains inREADME.mdanddoc/00-overview.md; the description now says what the package is for.
Note #
0.1.1 is published on pub.dev from a commit where this package did not
compile. Consider a 0.1.2 yank or an explicit note; this PR does not do it.
0.1.1 #
- Use exported
pqforgeSHAKE256 instead of direct import frompqcrypto(R3).
0.1.0 #
- Initial version.
- Added defensive-research documentation under
doc/(overview, architecture, classical catalog, PQ design, package utilization, SOC playbooks, adversarial hardness, implementation roadmap, ethics) and living progress trackerdoc/PROGRESS.md. - Root
README.mdpoints todoc/with authorized-use banner. - R1 classical P0: Locky, QakBot, Suppobox-style, Banjori, Ranbyus configs + generator paths, public exports, SOC metadata, and golden tests (
test/pqdga_test.dart, Suppobox wordlist fixture). - R2: Classical + PQ registry dispatch;
PQDGAResult(predictable/secretBound/kem/sig fields);PredictabilityClassenum. - R3:
QuantumResistantPqdgaSHAKE256 path viapqforge;swissarmyknifeepoch/Result DNS helpers; depspqforge+swissarmyknife; golden tests + example IOC lesson (“PQ hash ≠ secret”). - R4:
SharedSecretPqdgaML-KEM ss → SHAKE labels viapqforgeencaps/decaps;labEstablishhelper;predictable=false/secretBound=true+ KEM IOC metadata; golden + round-trip tests; example demo. - R5:
SignatureAuthenticatedPqdgaML-DSA sign/verify over canonical domain‖epoch‖campaign; detached sigs + pubkey fingerprint onPQDGAResult;requires_signatureP5 playbook flags; golden domains + verify/tamper drills; example lab verify. - R6:
IdentityBasedPqdga(vk namespace ± optional sign),HybridSharedSecretPqdga(PqForgeCombinerclassical‖ML-KEM),DecentralizedPqdga(base32 DNS + abstract ids); goldens + registry complete for PQ core. - R7:
SocFeaturesper-domain/batch feature extraction + IOC template helper; example prints features/IOC beside domains; SOC docs/PROGRESS updated. - R8: Research generics (Markov, IDN/punycode, oracle-seed, multi-channel, fast-flux schedule, nested labels); classical P1/P2 malware-style families; PQ extras (
EnvelopeRendezvousPqdga,RateLimitedPqdga,MultiRecipientPqdga); pre-P0 golden coverage. - R9 binding research ladder: NIST SP 800-185
Kmac256helper;KmacSharedSecretPqdga,HybridKmacPqdga,RatchetingPqdga,HierarchicalPqdga,MultiPartyPqdga,ThresholdPqdga,AuthenticatedContextPqdga; registry + goldens; docs distinguish MultiRecipient wrap vs multi-party/threshold joint derivation; conservative novelty framing (construction class, not new primitive); roadmap R0–R9 complete. - Post-R9 polish:
ClassicalSocMetadata+ full SOC metadata/playbook_flags/soc_lessonon all classical families;SocFeatures.iocTemplateFromDga;HardnessScorecardH1–H7 emission; example classical+PQ IOC/hardness lines; docs hygiene (00-overviewbaseline, open/deferred section in PROGRESS, scrub stub language in 03/04/07). - Post-R9 library hooks: bump
pqforgeto ^0.4.0 (dependency override while pqforge 0.3 pins ^0.3.1); real FIPS 205SlhDsaCheckpointPqdgaviapqcrypto.SlhDsa(sizes fromSlhDsaParams);LexicalSharedSecretPqdga(ML-KEM + lexical codec);HybridAuthenticatedPqdgaviaPqForgeHybridSigner;PostRendezvousSessionviaPqForgeSecureSession; lab surfacesDetectorNotebook/BindingAnalysis/LabHarness/LiteratureCorpus; primitive policy pqforge → pqcrypto → other (no reimplementation of shipped NIST PQ). - Post-R9 analysis & fidelity: P1/P2 literature-perfect re-keys against baderj (
literature_prng, goldens); deeperLabHarness(cron, CodecPipeline bulk, Log capture); binding-ladder notebooks underdoc/notebooks/;NotebookConsumerfor DetectorNotebook/HardnessScorecard/SLH IOC catalog;SlhDsaProviderpreference gate (still pqcrypto until pqforge ships SLH-DSA).