flutter_mldsa 0.1.1-dev.5
flutter_mldsa: ^0.1.1-dev.5 copied to clipboard
Pointycastle interface implentations for MlDsa using bindings to RustCrypto implementation of ml-dsa
Flutter MlDsa #
Pointycastle interface implentations for MlDsa using bindings to RustCrypto implementation of ml-dsa
⚠️ Security Warning #
The implementation contained in this crate has never been independently audited!
USE AT YOUR OWN RISK!
If you have discovered a security vulnerability in this project, please report it privately. Do not disclose it as a public issue. This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released. See SECURITY.md for more details.
PQC-MlDsa #
Getting started #
To generate the needed files for the bridge:
flutter_rust_bridge_codegen generate --watch --stop-on-error
Testing #
Rust-Side #
cd rust
cargo test -- --show-output
Flutter-Side #
cd example
flutter test -d $DEVICE integration_test/master_integration_test.dart
where $DEVICE is set to a device on the platform you want to test (for example linux, emulator-5554)
Usage #
- Initialize the FlutterMldsa:
await FlutterMldsa.init();
- Create a MlDsaKeyGenerator:
final keyGenerator = MlDsaKeyGenerator();
OR
final keyGenerator = KeyGenerator('Mldsa'); //Case sensitive
- Initialize the generator with a mode to generate
final generatorParams = MlDsaKeyGeneratorParams(mlDsaMode: MlDsaMode.MLDSA44);
keyGenerator.init(generatorParams);
- Generate a keypair:
final keypairA = keyGenerator.generateKeyPair();
- Create a Signer and initialize it:
final signer = MlDsaSigner();
signer.init(true, PrivateKeyParameter<MlDsaPrivateKey>(keypairA.privateKeyBytes));
- Create a verify and Initialize it:
final verifier = MlDsaSigner();
verifier.init(false, PublicKeyParameter<MlDsaPublicKey>(keypairA.publicKeyBytes));
- Use the MlDsaSigner functions to sign and verify:
final signature = signer.generateSignature(message);
final result = verifierCorrect.verifySignature(message, signature);
- (End of usage) Dispose the FlutterMldsa:
FlutterMldsa.dispose();
License #
Licensed at: