@sebastienrousseau/crypto-cli 0.0.8 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +685 -3
  2. package/dist/cli.js +37 -196
  3. package/dist/commands/decrypt.command.js +2 -2
  4. package/dist/commands/encrypt.command.js +2 -2
  5. package/dist/commands/generate.command.js +2 -2
  6. package/dist/commands/modern/cbom.command.d.ts +2 -1
  7. package/dist/commands/modern/cbom.command.d.ts.map +1 -1
  8. package/dist/commands/modern/cbom.command.js +99 -146
  9. package/dist/commands/modern/cbom.core.d.ts +5 -0
  10. package/dist/commands/modern/cbom.core.d.ts.map +1 -0
  11. package/dist/commands/modern/cbom.core.js +57 -0
  12. package/dist/commands/modern/encrypt.command.d.ts.map +1 -1
  13. package/dist/commands/modern/encrypt.command.js +42 -63
  14. package/dist/commands/modern/hash.command.d.ts.map +1 -1
  15. package/dist/commands/modern/hash.command.js +1 -1
  16. package/dist/commands/modern/keygen.command.js +1 -1
  17. package/dist/commands/modern/password-hash.command.d.ts.map +1 -1
  18. package/dist/commands/modern/password-hash.command.js +28 -27
  19. package/dist/commands/modern/sign.command.d.ts.map +1 -1
  20. package/dist/commands/modern/sign.command.js +83 -73
  21. package/dist/commands/reformat.command.js +2 -2
  22. package/dist/commands/revoke.command.js +2 -2
  23. package/dist/commands/session.command.js +2 -2
  24. package/dist/commands/sign.command.js +2 -2
  25. package/dist/commands/verify.command.js +2 -2
  26. package/dist/menu.d.ts +12 -0
  27. package/dist/menu.d.ts.map +1 -0
  28. package/dist/menu.js +107 -0
  29. package/dist/program/cbom.d.ts +4 -0
  30. package/dist/program/cbom.d.ts.map +1 -0
  31. package/dist/program/cbom.js +49 -0
  32. package/dist/program/encrypt.d.ts +6 -0
  33. package/dist/program/encrypt.d.ts.map +1 -0
  34. package/dist/program/encrypt.js +73 -0
  35. package/dist/program/hash.d.ts +4 -0
  36. package/dist/program/hash.d.ts.map +1 -0
  37. package/dist/program/hash.js +21 -0
  38. package/dist/program/hpke.d.ts +4 -0
  39. package/dist/program/hpke.d.ts.map +1 -0
  40. package/dist/program/hpke.js +111 -0
  41. package/dist/program/index.d.ts +7 -0
  42. package/dist/program/index.d.ts.map +1 -0
  43. package/dist/program/index.js +77 -0
  44. package/dist/program/io.d.ts +35 -0
  45. package/dist/program/io.d.ts.map +1 -0
  46. package/dist/program/io.js +65 -0
  47. package/dist/program/keygen.d.ts +4 -0
  48. package/dist/program/keygen.d.ts.map +1 -0
  49. package/dist/program/keygen.js +32 -0
  50. package/dist/program/kms.d.ts +8 -0
  51. package/dist/program/kms.d.ts.map +1 -0
  52. package/dist/program/kms.js +247 -0
  53. package/dist/program/opaque.d.ts +4 -0
  54. package/dist/program/opaque.d.ts.map +1 -0
  55. package/dist/program/opaque.js +209 -0
  56. package/dist/program/password.d.ts +4 -0
  57. package/dist/program/password.d.ts.map +1 -0
  58. package/dist/program/password.js +73 -0
  59. package/dist/program/secrets.d.ts +30 -0
  60. package/dist/program/secrets.d.ts.map +1 -0
  61. package/dist/program/secrets.js +70 -0
  62. package/dist/program/sign.d.ts +18 -0
  63. package/dist/program/sign.d.ts.map +1 -0
  64. package/dist/program/sign.js +130 -0
  65. package/dist/program/stream-multi.d.ts +7 -0
  66. package/dist/program/stream-multi.d.ts.map +1 -0
  67. package/dist/program/stream-multi.js +163 -0
  68. package/dist/program/stream.d.ts +6 -0
  69. package/dist/program/stream.d.ts.map +1 -0
  70. package/dist/program/stream.js +102 -0
  71. package/dist/program/usage.d.ts +7 -0
  72. package/dist/program/usage.d.ts.map +1 -0
  73. package/dist/program/usage.js +36 -0
  74. package/package.json +21 -34
package/README.md CHANGED
@@ -75,7 +75,23 @@ yarn add @sebastienrousseau/crypto-cli
75
75
 
76
76
  ## Quick Start
77
77
 
78
- Launch the interactive menu:
78
+ Run a subcommand, for scripts and CI:
79
+
80
+ ```bash
81
+ crypto-cli hash --json < file.txt
82
+ crypto-cli hash --algorithm blake3 file.txt
83
+ crypto-cli cbom scan src --output cbom.json
84
+
85
+ openssl rand -hex 32 > secret.key && chmod 600 secret.key
86
+ crypto-cli encrypt --key-file secret.key file.txt > file.txt.sealed
87
+ crypto-cli decrypt --key-file secret.key file.txt.sealed > file.txt.out
88
+
89
+ crypto-cli keygen --algorithm ed25519 --json > signer.json && chmod 600 signer.json
90
+ crypto-cli sign --key-file signer.json file.txt > file.txt.sig
91
+ crypto-cli verify --key-file signer.json --signature-file file.txt.sig file.txt
92
+ ```
93
+
94
+ Run it with no arguments in a terminal for the interactive menu:
79
95
 
80
96
  ```bash
81
97
  cryptocli
@@ -134,8 +150,10 @@ crypto-cli is the command-line interface for the Crypto Service
134
150
  Suite. It offers both legacy OpenPGP commands (key generation,
135
151
  encryption, decryption, signing, verification, revocation) and
136
152
  modern v2 commands using `@noble/*` primitives with post-quantum
137
- algorithm support. All operations run interactively via a guided
138
- prompt menu.
153
+ algorithm support. Hashing, key generation, symmetric encryption,
154
+ signing, password hashing and CBOM scan and audit also run as
155
+ non-interactive subcommands with JSON output; every operation is
156
+ available from the interactive menu.
139
157
 
140
158
  <p align="right"><a href="#contents">Back to Top</a></p>
141
159
 
@@ -164,6 +182,670 @@ prompt menu.
164
182
  | `Modern Sign` | Sign and verify with 8 algorithms including ML-DSA |
165
183
  | `Password Hash` | Hash and verify passwords with 3 Argon2 variants |
166
184
 
185
+ ### Non-interactive commands
186
+
187
+ With arguments, `crypto-cli` runs a subcommand instead of the menu:
188
+
189
+ - `--json` prints the result as one line of JSON on stdout, and
190
+ nothing else goes to stdout.
191
+ - A command that takes a file reads standard input when the file is
192
+ omitted or `-`.
193
+ - Errors, usage and notes go to stderr.
194
+ - Exit codes: `0` success, `1` the operation failed (unreadable input,
195
+ a cryptographic error, a wrong key or modified ciphertext, a
196
+ signature or password that does not verify, an invalid CBOM, a CBOM
197
+ audit with status `FAIL`), `2` usage error (unknown command or
198
+ option, missing or invalid argument, no key or password source, key
199
+ and data both on standard input).
200
+ - With no arguments, the interactive menu starts only when stdin and
201
+ stdout are both terminals; otherwise usage goes to stderr and the
202
+ exit code is `2`.
203
+
204
+ Keys and passwords are never command-line values, which other users
205
+ can see in the process list and shells keep in their history:
206
+
207
+ - `encrypt`, `decrypt`, `sign` and `verify` read the key from
208
+ `--key-file <path>`, or from standard input with `--key-stdin`, in
209
+ which case the data must be a file argument (a run with both on
210
+ standard input exits `2`). `password hash` and `password verify`
211
+ take `--password-file <path>` or `--password-stdin` in the same way
212
+ (one trailing line break is ignored), and otherwise ask for the
213
+ password with a hidden prompt when standard input is a terminal
214
+ (twice for `password hash`).
215
+ - `encrypt` and `decrypt` use XChaCha20-Poly1305 (crypto-lib's
216
+ secretbox). The key is 32 bytes, written as 64 hexadecimal
217
+ characters or raw. `encrypt` prints base64 of the 24-byte nonce,
218
+ the ciphertext and the 16-byte tag; `decrypt` reads that or the
219
+ `encrypt --json` line and writes the plaintext bytes unchanged
220
+ (base64 in its `--json` output).
221
+ - `sign` reads a key pair saved from `keygen --json` (Ed25519,
222
+ Ed448, P-256, P-384 or ML-DSA) and prints the signature in hex.
223
+ `verify` reads the same file, or JSON with only `algorithm` and
224
+ `publicKey`, and prints `valid` or `invalid` (`{"valid": ...}` with
225
+ `--json`), exiting `1` when the signature does not verify.
226
+ - `password hash` uses Argon2id with crypto-lib's defaults (t=3,
227
+ m=64 MiB, p=4) and prints a PHC string; `password verify` reads it
228
+ from a file or standard input.
229
+ - On Linux and macOS, a secret file that its group or other users can
230
+ read gets a warning on stderr (`chmod 600` it); the command still
231
+ runs, because secrets mounted by container platforms are often
232
+ group- or world-readable. Windows has no such mode bits, so nothing
233
+ is checked there.
234
+
235
+ The reference below is generated from the command definitions
236
+ (`pnpm run readme:usage`); a test fails when it is out of date.
237
+
238
+ <!-- cli-usage:start (generated: pnpm run readme:usage) -->
239
+
240
+ #### `crypto-cli`
241
+
242
+ ```text
243
+ Usage: crypto-cli [options] [command]
244
+
245
+ Cryptographic operations from the command line. Run without arguments in a
246
+ terminal for the interactive menu.
247
+
248
+ Options:
249
+ -V, --version print the version
250
+ -h, --help print help
251
+
252
+ Commands:
253
+ hash [options] [file] Hash a file, or standard input when no file is given
254
+ keygen [options] Generate a key pair (the private key is printed to
255
+ stdout)
256
+ encrypt [options] [file] Encrypt with XChaCha20-Poly1305 and print the sealed
257
+ box as base64
258
+ decrypt [options] [file] Decrypt the output of encrypt; exits 1 on a wrong
259
+ key or modified input
260
+ sign [options] [file] Sign a file with a key pair from keygen --json and
261
+ print the signature in hex
262
+ verify [options] [file] Verify a signature from sign; exits 1 when it is not
263
+ valid
264
+ password Hash or verify a password (Argon2id)
265
+ cbom Generate or audit a Cryptographic Bill of Materials
266
+ stream Post-quantum hybrid streaming AEAD operations
267
+ opaque OPAQUE zero-knowledge password authentication (RFC
268
+ 9807)
269
+ hpke Hybrid Public Key Encryption (HPKE RFC 9180 and PQ
270
+ hybrid)
271
+ kms Key Management Service (KMS) operations across
272
+ native cloud providers
273
+ ```
274
+
275
+ #### `crypto-cli hash`
276
+
277
+ ```text
278
+ Usage: crypto-cli hash [options] [file]
279
+
280
+ Hash a file, or standard input when no file is given
281
+
282
+ Arguments:
283
+ file file to hash; '-' or omitted reads standard input
284
+
285
+ Options:
286
+ -a, --algorithm <name> hash algorithm (choices: "sha256", "sha384", "sha512",
287
+ "sha3-256", "sha3-512", "blake2b", "blake3", default:
288
+ "sha256")
289
+ --json print the result as one line of JSON
290
+ -h, --help print help
291
+ ```
292
+
293
+ #### `crypto-cli keygen`
294
+
295
+ ```text
296
+ Usage: crypto-cli keygen [options]
297
+
298
+ Generate a key pair (the private key is printed to stdout)
299
+
300
+ Options:
301
+ -a, --algorithm <name> key algorithm (choices: "ed25519", "x25519", "ed448",
302
+ "x448", "p256", "p384", "ml-kem-512", "ml-kem-768",
303
+ "ml-kem-1024", "ml-dsa-44", "ml-dsa-65", "ml-dsa-87")
304
+ --kid <id> key ID (default: thumbprint of the public key)
305
+ --use <use> intended key usage (choices: "sig", "enc")
306
+ --json print the key pair as one line of JSON
307
+ -h, --help print help
308
+ ```
309
+
310
+ #### `crypto-cli encrypt`
311
+
312
+ ```text
313
+ Usage: crypto-cli encrypt [options] [file]
314
+
315
+ Encrypt with XChaCha20-Poly1305 and print the sealed box as base64
316
+
317
+ Arguments:
318
+ file file to encrypt; '-' or omitted reads standard input
319
+
320
+ Options:
321
+ --key-file <path> read the key from a file: 32 bytes, as 64 hex characters or
322
+ raw
323
+ --key-stdin read the key from standard input (the data must then be a
324
+ file argument)
325
+ --json print the result as one line of JSON
326
+ -h, --help print help
327
+ ```
328
+
329
+ #### `crypto-cli decrypt`
330
+
331
+ ```text
332
+ Usage: crypto-cli decrypt [options] [file]
333
+
334
+ Decrypt the output of encrypt; exits 1 on a wrong key or modified input
335
+
336
+ Arguments:
337
+ file output of encrypt (base64 or its --json line); '-' or
338
+ omitted reads standard input
339
+
340
+ Options:
341
+ --key-file <path> read the key from a file: 32 bytes, as 64 hex characters or
342
+ raw
343
+ --key-stdin read the key from standard input (the data must then be a
344
+ file argument)
345
+ --json print the result as one line of JSON
346
+ -h, --help print help
347
+ ```
348
+
349
+ #### `crypto-cli sign`
350
+
351
+ ```text
352
+ Usage: crypto-cli sign [options] [file]
353
+
354
+ Sign a file with a key pair from keygen --json and print the signature in hex
355
+
356
+ Arguments:
357
+ file file to sign; '-' or omitted reads standard input
358
+
359
+ Options:
360
+ --key-file <path> read the key pair from a file: keygen --json output
361
+ (ed25519, ed448, p256, p384, ml-dsa-44, ml-dsa-65,
362
+ ml-dsa-87)
363
+ --key-stdin read the key pair from standard input (the data must then
364
+ be a file argument)
365
+ --json print the result as one line of JSON
366
+ -h, --help print help
367
+ ```
368
+
369
+ #### `crypto-cli verify`
370
+
371
+ ```text
372
+ Usage: crypto-cli verify [options] [file]
373
+
374
+ Verify a signature from sign; exits 1 when it is not valid
375
+
376
+ Arguments:
377
+ file file to verify; '-' or omitted reads standard input
378
+
379
+ Options:
380
+ --key-file <path> read the public key from a file: keygen --json
381
+ output, or JSON with algorithm and publicKey
382
+ --key-stdin read the public key from standard input (the data
383
+ must then be a file argument)
384
+ --signature <hex> the signature, in hex
385
+ --signature-file <path> read the signature from a file (sign output or its
386
+ --json line)
387
+ --json print the result as one line of JSON
388
+ -h, --help print help
389
+ ```
390
+
391
+ #### `crypto-cli password`
392
+
393
+ ```text
394
+ Usage: crypto-cli password [options] [command]
395
+
396
+ Hash or verify a password (Argon2id)
397
+
398
+ Options:
399
+ -h, --help print help
400
+
401
+ Commands:
402
+ hash [options] Hash a password with Argon2id (crypto-lib defaults:
403
+ t=3, m=64 MiB, p=4) and print its PHC string
404
+ verify [options] [file] Check a password against a PHC string; exits 1 when
405
+ it does not match
406
+ ```
407
+
408
+ #### `crypto-cli password hash`
409
+
410
+ ```text
411
+ Usage: crypto-cli password hash [options]
412
+
413
+ Hash a password with Argon2id (crypto-lib defaults: t=3, m=64 MiB, p=4) and
414
+ print its PHC string
415
+
416
+ Options:
417
+ --password-file <path> read the password from a file: one trailing line break
418
+ is ignored
419
+ --password-stdin read the password from standard input
420
+ --json print the result as one line of JSON
421
+ -h, --help print help
422
+ ```
423
+
424
+ #### `crypto-cli password verify`
425
+
426
+ ```text
427
+ Usage: crypto-cli password verify [options] [file]
428
+
429
+ Check a password against a PHC string; exits 1 when it does not match
430
+
431
+ Arguments:
432
+ file PHC string (password hash output or its --json line);
433
+ '-' or omitted reads standard input
434
+
435
+ Options:
436
+ --password-file <path> read the password from a file: one trailing line break
437
+ is ignored
438
+ --password-stdin read the password from standard input (the data must
439
+ then be a file argument)
440
+ --json print the result as one line of JSON
441
+ -h, --help print help
442
+ ```
443
+
444
+ #### `crypto-cli cbom`
445
+
446
+ ```text
447
+ Usage: crypto-cli cbom [options] [command]
448
+
449
+ Generate or audit a Cryptographic Bill of Materials
450
+
451
+ Options:
452
+ -h, --help print help
453
+
454
+ Commands:
455
+ scan [options] [directory] Scan source code and print its CBOM
456
+ audit [options] [file] Validate and audit a CBOM; exits 1 when the audit
457
+ status is FAIL
458
+ ```
459
+
460
+ #### `crypto-cli cbom scan`
461
+
462
+ ```text
463
+ Usage: crypto-cli cbom scan [options] [directory]
464
+
465
+ Scan source code and print its CBOM
466
+
467
+ Arguments:
468
+ directory directory or file to scan (default: ".")
469
+
470
+ Options:
471
+ -f, --format <format> CBOM standard (choices: "cyclonedx", "spdx", default:
472
+ "cyclonedx")
473
+ -o, --output <file> write the CBOM to a file, not stdout
474
+ --json print the CBOM as one line of JSON
475
+ -h, --help print help
476
+ ```
477
+
478
+ #### `crypto-cli cbom audit`
479
+
480
+ ```text
481
+ Usage: crypto-cli cbom audit [options] [file]
482
+
483
+ Validate and audit a CBOM; exits 1 when the audit status is FAIL
484
+
485
+ Arguments:
486
+ file CBOM JSON file; '-' or omitted reads standard input
487
+
488
+ Options:
489
+ -o, --output <file> write the audit report to a file, not stdout
490
+ --json print the audit report as one line of JSON
491
+ -h, --help print help
492
+ ```
493
+
494
+ #### `crypto-cli stream`
495
+
496
+ ```text
497
+ Usage: crypto-cli stream [options] [command]
498
+
499
+ Post-quantum hybrid streaming AEAD operations
500
+
501
+ Options:
502
+ -h, --help print help
503
+
504
+ Commands:
505
+ encrypt [options] [file] Encrypt with post-quantum hybrid STREAM AEAD
506
+ (X25519 + ML-KEM-768)
507
+ decrypt [options] [file] Decrypt post-quantum hybrid STREAM ciphertext;
508
+ exits 1 on error
509
+ multi-encrypt [options] [file] Encrypt for multiple recipients with
510
+ post-quantum hybrid STREAM AEAD
511
+ multi-decrypt [options] [file] Decrypt multi-recipient post-quantum hybrid
512
+ STREAM ciphertext; exits 1 on error
513
+ help [command] display help for command
514
+ ```
515
+
516
+ #### `crypto-cli stream encrypt`
517
+
518
+ ```text
519
+ Usage: crypto-cli stream encrypt [options] [file]
520
+
521
+ Encrypt with post-quantum hybrid STREAM AEAD (X25519 + ML-KEM-768)
522
+
523
+ Arguments:
524
+ file file to encrypt; '-' or omitted reads standard
525
+ input
526
+
527
+ Options:
528
+ -x, --x25519-public <hex> recipient X25519 public key (hex)
529
+ -m, --ml-kem-public <hex> recipient ML-KEM-768 public key (hex)
530
+ -c, --chunk-size <bytes> chunk size in bytes (minimum 64, default 65536)
531
+ --json print the result as one line of JSON
532
+ -h, --help print help
533
+ ```
534
+
535
+ #### `crypto-cli stream decrypt`
536
+
537
+ ```text
538
+ Usage: crypto-cli stream decrypt [options] [file]
539
+
540
+ Decrypt post-quantum hybrid STREAM ciphertext; exits 1 on error
541
+
542
+ Arguments:
543
+ file output of stream encrypt (base64 or its --json
544
+ line)
545
+
546
+ Options:
547
+ -x, --x25519-secret <hex> recipient X25519 secret key (hex)
548
+ -m, --ml-kem-secret <hex> recipient ML-KEM-768 secret key (hex)
549
+ -c, --chunk-size <bytes> chunk size in bytes
550
+ --json print the result as one line of JSON
551
+ -h, --help print help
552
+ ```
553
+
554
+ #### `crypto-cli stream multi-encrypt`
555
+
556
+ ```text
557
+ Usage: crypto-cli stream multi-encrypt [options] [file]
558
+
559
+ Encrypt for multiple recipients with post-quantum hybrid STREAM AEAD
560
+
561
+ Arguments:
562
+ file file to encrypt; '-' or omitted reads
563
+ standard input
564
+
565
+ Options:
566
+ -r, --recipients <json-or-path> JSON array string or file path containing
567
+ recipient public key descriptors
568
+ -c, --chunk-size <bytes> chunk size in bytes (minimum 1024, default
569
+ 65536)
570
+ --json print the result as one line of JSON
571
+ -h, --help print help
572
+ ```
573
+
574
+ #### `crypto-cli stream multi-decrypt`
575
+
576
+ ```text
577
+ Usage: crypto-cli stream multi-decrypt [options] [file]
578
+
579
+ Decrypt multi-recipient post-quantum hybrid STREAM ciphertext; exits 1 on error
580
+
581
+ Arguments:
582
+ file output of stream multi-encrypt (base64 or its
583
+ --json line)
584
+
585
+ Options:
586
+ -x, --x25519-secret <hex> recipient X25519 secret key (hex)
587
+ -m, --ml-kem-secret <hex> recipient ML-KEM-768 secret key (hex)
588
+ -i, --recipient-id <id> optional recipient identifier for direct slot
589
+ lookup
590
+ -c, --chunk-size <bytes> chunk size in bytes
591
+ --json print the result as one line of JSON
592
+ -h, --help print help
593
+ ```
594
+
595
+ #### `crypto-cli opaque`
596
+
597
+ ```text
598
+ Usage: crypto-cli opaque [options] [command]
599
+
600
+ OPAQUE zero-knowledge password authentication (RFC 9807)
601
+
602
+ Options:
603
+ -h, --help print help
604
+
605
+ Commands:
606
+ setup [options] Generate server long-term keys and fake record
607
+ register [options] <id> Register a password with an OPAQUE server
608
+ login [options] <id> Authenticate against an OPAQUE server
609
+ ```
610
+
611
+ #### `crypto-cli opaque setup`
612
+
613
+ ```text
614
+ Usage: crypto-cli opaque setup [options]
615
+
616
+ Generate server long-term keys and fake record
617
+
618
+ Options:
619
+ -s, --suite <name> ciphersuite (choices: "P256-SHA256",
620
+ "ristretto255-SHA512", default: "P256-SHA256")
621
+ --json print result as JSON
622
+ -h, --help print help
623
+ ```
624
+
625
+ #### `crypto-cli opaque register`
626
+
627
+ ```text
628
+ Usage: crypto-cli opaque register [options] <id>
629
+
630
+ Register a password with an OPAQUE server
631
+
632
+ Options:
633
+ -u, --server-url <url> server base URL
634
+ -s, --suite <name> ciphersuite (choices: "P256-SHA256",
635
+ "ristretto255-SHA512", default: "P256-SHA256")
636
+ --json print result as JSON
637
+ --password-file <path> read the password from a file: one trailing line break
638
+ is ignored
639
+ --password-stdin read the password from standard input
640
+ -h, --help print help
641
+ ```
642
+
643
+ #### `crypto-cli opaque login`
644
+
645
+ ```text
646
+ Usage: crypto-cli opaque login [options] <id>
647
+
648
+ Authenticate against an OPAQUE server
649
+
650
+ Options:
651
+ -u, --server-url <url> server base URL
652
+ -s, --suite <name> ciphersuite (choices: "P256-SHA256",
653
+ "ristretto255-SHA512", default: "P256-SHA256")
654
+ --json print result as JSON
655
+ --password-file <path> read the password from a file: one trailing line break
656
+ is ignored
657
+ --password-stdin read the password from standard input
658
+ -h, --help print help
659
+ ```
660
+
661
+ #### `crypto-cli hpke`
662
+
663
+ ```text
664
+ Usage: crypto-cli hpke [options] [command]
665
+
666
+ Hybrid Public Key Encryption (HPKE RFC 9180 and PQ hybrid)
667
+
668
+ Options:
669
+ -h, --help print help
670
+
671
+ Commands:
672
+ keygen [options] Generate an HPKE key pair
673
+ seal [options] [file] Encrypt a message using HPKE
674
+ open [options] [file] Decrypt an HPKE ciphertext
675
+ help [command] display help for command
676
+ ```
677
+
678
+ #### `crypto-cli hpke keygen`
679
+
680
+ ```text
681
+ Usage: crypto-cli hpke keygen [options]
682
+
683
+ Generate an HPKE key pair
684
+
685
+ Options:
686
+ -k, --kem <kem> key encapsulation mechanism (choices: "x25519-ml-kem-768",
687
+ "x25519", "p256", default: "x25519-ml-kem-768")
688
+ --json print key pair as JSON
689
+ -h, --help print help
690
+ ```
691
+
692
+ #### `crypto-cli hpke seal`
693
+
694
+ ```text
695
+ Usage: crypto-cli hpke seal [options] [file]
696
+
697
+ Encrypt a message using HPKE
698
+
699
+ Options:
700
+ -p, --public-key <hex> recipient public key (hex)
701
+ -k, --kem <kem> key encapsulation mechanism (choices:
702
+ "x25519-ml-kem-768", "x25519", "p256", default:
703
+ "x25519-ml-kem-768")
704
+ -a, --aead <aead> authenticated encryption algorithm (choices:
705
+ "chacha20-poly1305", "aes-128-gcm", default:
706
+ "chacha20-poly1305")
707
+ --info <info> application-supplied info string
708
+ --aad <aad> additional authenticated data
709
+ --json print ciphertext and encapsulated key as JSON
710
+ -h, --help print help
711
+ ```
712
+
713
+ #### `crypto-cli hpke open`
714
+
715
+ ```text
716
+ Usage: crypto-cli hpke open [options] [file]
717
+
718
+ Decrypt an HPKE ciphertext
719
+
720
+ Options:
721
+ -s, --secret-key <hex> recipient private key (hex)
722
+ -e, --encapsulated-key <hex> encapsulated key (hex)
723
+ -k, --kem <kem> key encapsulation mechanism (choices:
724
+ "x25519-ml-kem-768", "x25519", "p256", default:
725
+ "x25519-ml-kem-768")
726
+ -a, --aead <aead> authenticated encryption algorithm (choices:
727
+ "chacha20-poly1305", "aes-128-gcm", default:
728
+ "chacha20-poly1305")
729
+ --info <info> application-supplied info string
730
+ --aad <aad> additional authenticated data
731
+ --json print plaintext and hex as JSON
732
+ -h, --help print help
733
+ ```
734
+
735
+ #### `crypto-cli kms`
736
+
737
+ ```text
738
+ Usage: crypto-cli kms [options] [command]
739
+
740
+ Key Management Service (KMS) operations across native cloud providers
741
+
742
+ Options:
743
+ -h, --help print help
744
+
745
+ Commands:
746
+ create-key [options] Create a new managed key in KMS
747
+ generate-data-key [options] Generate a Data Encryption Key (DEK) via KMS
748
+ wrap [options] [file] Wrap (encrypt) a key using a KMS key
749
+ unwrap [options] [file] Unwrap a wrapped key using a KMS key
750
+ encrypt [options] [file] Encrypt data using a KMS key
751
+ decrypt [options] [file] Decrypt ciphertext using a KMS key
752
+ help [command] display help for command
753
+ ```
754
+
755
+ #### `crypto-cli kms create-key`
756
+
757
+ ```text
758
+ Usage: crypto-cli kms create-key [options]
759
+
760
+ Create a new managed key in KMS
761
+
762
+ Options:
763
+ -a, --algorithm <alg> Key algorithm (default: "aes-256-gcm")
764
+ -u, --usage <usage> Key usage (choices: "encrypt", "sign", "wrap", default:
765
+ "encrypt")
766
+ -p, --provider <name> KMS provider (local, aws, gcp, vault, azure) (default:
767
+ "local")
768
+ --json Emit output as JSON
769
+ -h, --help print help
770
+ ```
771
+
772
+ #### `crypto-cli kms generate-data-key`
773
+
774
+ ```text
775
+ Usage: crypto-cli kms generate-data-key [options]
776
+
777
+ Generate a Data Encryption Key (DEK) via KMS
778
+
779
+ Options:
780
+ -k, --key-id <id> Key ID
781
+ -s, --key-spec <spec> Key spec (e.g. AES_256) (default: "AES_256")
782
+ -p, --provider <name> KMS provider (default: "local")
783
+ --json Emit output as JSON
784
+ -h, --help print help
785
+ ```
786
+
787
+ #### `crypto-cli kms wrap`
788
+
789
+ ```text
790
+ Usage: crypto-cli kms wrap [options] [file]
791
+
792
+ Wrap (encrypt) a key using a KMS key
793
+
794
+ Options:
795
+ -k, --key-id <id> Wrapping Key ID
796
+ -w, --key <hex> Raw key material to wrap
797
+ -p, --provider <name> KMS provider (default: "local")
798
+ --json Emit output as JSON
799
+ -h, --help print help
800
+ ```
801
+
802
+ #### `crypto-cli kms unwrap`
803
+
804
+ ```text
805
+ Usage: crypto-cli kms unwrap [options] [file]
806
+
807
+ Unwrap a wrapped key using a KMS key
808
+
809
+ Options:
810
+ -k, --key-id <id> Wrapping Key ID
811
+ -w, --wrapped-key <str> Wrapped key string
812
+ -p, --provider <name> KMS provider (default: "local")
813
+ --json Emit output as JSON
814
+ -h, --help print help
815
+ ```
816
+
817
+ #### `crypto-cli kms encrypt`
818
+
819
+ ```text
820
+ Usage: crypto-cli kms encrypt [options] [file]
821
+
822
+ Encrypt data using a KMS key
823
+
824
+ Options:
825
+ -k, --key-id <id> Key ID
826
+ -d, --data <text> Plaintext data to encrypt
827
+ -p, --provider <name> KMS provider (default: "local")
828
+ --json Emit output as JSON
829
+ -h, --help print help
830
+ ```
831
+
832
+ #### `crypto-cli kms decrypt`
833
+
834
+ ```text
835
+ Usage: crypto-cli kms decrypt [options] [file]
836
+
837
+ Decrypt ciphertext using a KMS key
838
+
839
+ Options:
840
+ -k, --key-id <id> Key ID
841
+ -c, --ciphertext <str> Ciphertext to decrypt
842
+ -p, --provider <name> KMS provider (default: "local")
843
+ --json Emit output as JSON
844
+ -h, --help print help
845
+ ```
846
+
847
+ <!-- cli-usage:end -->
848
+
167
849
  <p align="right"><a href="#contents">Back to Top</a></p>
168
850
 
169
851
  ## Configuration