Skip to content

Commit 4d996a7

Browse files
committed
cli for ml-dsa done
1 parent 0c58cd5 commit 4d996a7

2 files changed

Lines changed: 1236 additions & 26 deletions

File tree

cli/src/main.rs

Lines changed: 136 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ enum Subcommands {
273273
x: bool,
274274
},
275275

276-
/// The MLDSA44 signature algorithm.
276+
/// The ML-DSA-44 signature algorithm.
277277
MLDSA44 {
278278
action: MLDSAAction,
279279

@@ -294,6 +294,136 @@ enum Subcommands {
294294
sigfile: Option<String>,
295295

296296

297+
#[arg(short)]
298+
/// Output in hex format.
299+
x: bool,
300+
},
301+
302+
/// The ML-DSA-65 signature algorithm.
303+
MLDSA65 {
304+
action: MLDSAAction,
305+
306+
#[arg(long)]
307+
/// The file containing context string (in hex) for signing or verifying
308+
ctxfile: Option<String>,
309+
310+
#[arg(long)]
311+
/// The private key file (in hex or binary) for signing
312+
skfile: Option<String>,
313+
314+
#[arg(long)]
315+
/// The public key file (in hex or binary) for verifying
316+
pkfile: Option<String>,
317+
318+
#[arg(long)]
319+
/// The signature value file (in hex or binary) for verifying
320+
sigfile: Option<String>,
321+
322+
323+
#[arg(short)]
324+
/// Output in hex format.
325+
x: bool,
326+
},
327+
328+
/// The ML-DSA-87 signature algorithm.
329+
MLDSA87 {
330+
action: MLDSAAction,
331+
332+
#[arg(long)]
333+
/// The file containing context string (in hex) for signing or verifying
334+
ctxfile: Option<String>,
335+
336+
#[arg(long)]
337+
/// The private key file (in hex or binary) for signing
338+
skfile: Option<String>,
339+
340+
#[arg(long)]
341+
/// The public key file (in hex or binary) for verifying
342+
pkfile: Option<String>,
343+
344+
#[arg(long)]
345+
/// The signature value file (in hex or binary) for verifying
346+
sigfile: Option<String>,
347+
348+
349+
#[arg(short)]
350+
/// Output in hex format.
351+
x: bool,
352+
},
353+
354+
/// The HashML-DSA-44 signature algorithm.
355+
HashMLDSA44 {
356+
action: MLDSAAction,
357+
358+
#[arg(long)]
359+
/// The file containing context string (in hex) for signing or verifying
360+
ctxfile: Option<String>,
361+
362+
#[arg(long)]
363+
/// The private key file (in hex or binary) for signing
364+
skfile: Option<String>,
365+
366+
#[arg(long)]
367+
/// The public key file (in hex or binary) for verifying
368+
pkfile: Option<String>,
369+
370+
#[arg(long)]
371+
/// The signature value file (in hex or binary) for verifying
372+
sigfile: Option<String>,
373+
374+
375+
#[arg(short)]
376+
/// Output in hex format.
377+
x: bool,
378+
},
379+
380+
/// The HashML-DSA-65 signature algorithm.
381+
HashMLDSA65 {
382+
action: MLDSAAction,
383+
384+
#[arg(long)]
385+
/// The file containing context string (in hex) for signing or verifying
386+
ctxfile: Option<String>,
387+
388+
#[arg(long)]
389+
/// The private key file (in hex or binary) for signing
390+
skfile: Option<String>,
391+
392+
#[arg(long)]
393+
/// The public key file (in hex or binary) for verifying
394+
pkfile: Option<String>,
395+
396+
#[arg(long)]
397+
/// The signature value file (in hex or binary) for verifying
398+
sigfile: Option<String>,
399+
400+
401+
#[arg(short)]
402+
/// Output in hex format.
403+
x: bool,
404+
},
405+
406+
/// The HashML-DSA87 signature algorithm.
407+
HashMLDSA87 {
408+
action: MLDSAAction,
409+
410+
#[arg(long)]
411+
/// The file containing context string (in hex) for signing or verifying
412+
ctxfile: Option<String>,
413+
414+
#[arg(long)]
415+
/// The private key file (in hex or binary) for signing
416+
skfile: Option<String>,
417+
418+
#[arg(long)]
419+
/// The public key file (in hex or binary) for verifying
420+
pkfile: Option<String>,
421+
422+
#[arg(long)]
423+
/// The signature value file (in hex or binary) for verifying
424+
sigfile: Option<String>,
425+
426+
297427
#[arg(short)]
298428
/// Output in hex format.
299429
x: bool,
@@ -356,6 +486,11 @@ fn main() {
356486
Some(Subcommands::HKDF_SHA512 { salt, salt_file, ikm, ikm_file, additional_input, additional_input_file, len, x}) => { hkdf_cmd::hkdf_cmd("HKDF-SHA512", salt, salt_file, ikm, ikm_file, additional_input, additional_input_file, *len, *x)},
357487
Some(Subcommands::RNG { len, x}) => { rng_cmd::rng_cmd(*len, *x)},
358488
Some(Subcommands::MLDSA44 { action, ctxfile, skfile, pkfile, sigfile, x }) => { mldsa_cmd::mldsa44_cmd(action, ctxfile, skfile, pkfile, sigfile, *x); }
489+
Some(Subcommands::MLDSA65 { action, ctxfile, skfile, pkfile, sigfile, x }) => { mldsa_cmd::mldsa65_cmd(action, ctxfile, skfile, pkfile, sigfile, *x); }
490+
Some(Subcommands::MLDSA87 { action, ctxfile, skfile, pkfile, sigfile, x }) => { mldsa_cmd::mldsa87_cmd(action, ctxfile, skfile, pkfile, sigfile, *x); }
491+
Some(Subcommands::HashMLDSA44 { action, ctxfile, skfile, pkfile, sigfile, x }) => { mldsa_cmd::hash_mldsa44_sha512_cmd(action, ctxfile, skfile, pkfile, sigfile, *x); }
492+
Some(Subcommands::HashMLDSA65 { action, ctxfile, skfile, pkfile, sigfile, x }) => { mldsa_cmd::hash_mldsa65_sha512_cmd(action, ctxfile, skfile, pkfile, sigfile, *x); }
493+
Some(Subcommands::HashMLDSA87 { action, ctxfile, skfile, pkfile, sigfile, x }) => { mldsa_cmd::hash_mldsa87_sha512_cmd(action, ctxfile, skfile, pkfile, sigfile, *x); }
359494
None => { eprintln!("No command provided. See -h") },
360495
}
361496
}

0 commit comments

Comments
 (0)