|
| 1 | +# Description |
| 2 | + |
| 3 | +Simple example of wolfCrypt ML-DSA keygen, signing, and verifying. |
| 4 | + |
| 5 | +Requires wolfSSL is built with: |
| 6 | + |
| 7 | +```sh |
| 8 | +./configure --enable-dilithium |
| 9 | +make |
| 10 | +make install |
| 11 | +``` |
| 12 | + |
| 13 | +Build the ML-DSA example with: |
| 14 | + |
| 15 | +```sh |
| 16 | +make ml_dsa_test |
| 17 | +``` |
| 18 | + |
| 19 | +# Usage |
| 20 | + |
| 21 | +``` |
| 22 | +./ml_dsa_test -? |
| 23 | +usage: |
| 24 | + ./ml_dsa_test [-pvw] -c <security category> [-m <message>] |
| 25 | +
|
| 26 | +parms: |
| 27 | + -m <message> the message to sign |
| 28 | + -c <security category> set the security category {2,3,5} |
| 29 | + -p print FIPS 204 parameters and exit |
| 30 | + -v verbose |
| 31 | + -w write keys, msg, and sig to file |
| 32 | + -? show this help |
| 33 | +``` |
| 34 | + |
| 35 | +## Keygen, sign, and verify |
| 36 | + |
| 37 | +This will generate a keypair with security category 5, then |
| 38 | +sign and verify a test message, and write the keys, message, |
| 39 | +and signature to `*.key` and `*.bin` files: |
| 40 | +``` |
| 41 | +./ml_dsa_test -c 5 -m "my test message" -w |
| 42 | +info: making key |
| 43 | +info: using ML-DSA-87, Security Category 5: priv_len 4896, pub_len 2592, sig_len 4627 |
| 44 | +info: signed message |
| 45 | +info: verify message good |
| 46 | +info: done |
| 47 | +``` |
| 48 | + |
| 49 | +## Print Supported ML-DSA Parameters |
| 50 | + |
| 51 | +To see the supported parameters: |
| 52 | + |
| 53 | +``` |
| 54 | +./ml_dsa_test -p |
| 55 | +ML-DSA parameters and key/sig sizes* |
| 56 | +
|
| 57 | + Private Key Public Key Signature Size Security Strength |
| 58 | + ML-DSA-44 2560 1312 2420 Category 2 |
| 59 | + ML-DSA-65 4032 1952 3309 Category 3 |
| 60 | + ML-DSA-87 4896 2592 4627 Category 5 |
| 61 | +
|
| 62 | +
|
| 63 | +* from Tables 1 & 2 of FIPS 204: |
| 64 | + https://csrc.nist.gov/pubs/fips/204/final |
| 65 | +``` |
0 commit comments