xdsa library
Composite ML-DSA cryptography wrappers and parametrization.
https://datatracker.ietf.org/doc/html/draft-ietf-lamps-pq-composite-sigs
A key signs a message with ML-DSA-65 and Ed25519 at once, and a signature verifies only if both halves do. Keys and signatures round-trip through fixed-size byte arrays. Keys also support DER and PEM serialization.
import 'dart:convert';
import 'package:darkbio_crypto/xdsa.dart' as xdsa;
void example() {
final secret = xdsa.SecretKey.generate();
final public = secret.publicKey();
final signature = secret.sign(utf8.encode('hello'));
public.verify(utf8.encode('hello'), signature);
// A key restored from PEM is the same key
final restored = xdsa.PublicKey.fromPem(public.toPem());
assert(restored.fingerprint() == public.fingerprint());
}
Classes
- Fingerprint
- A 256-bit unique identifier for an xDSA key.
- PublicKey
- An ML-DSA-65 public key paired with an Ed25519 public key for verifying quantum resistant digital signatures.
- SecretKey
- An ML-DSA-65 private key paired with an Ed25519 private key for creating and verifying quantum resistant digital signatures.
- Signature
- An ML-DSA-65 signature (3309 bytes) paired with an Ed25519 signature (64 bytes), 3373 bytes in total.