parent
7e3334740c
commit
24b383275a
@ -8,6 +8,45 @@ use openpgp::KeyHandle;
|
||||
use super::types::ClapData;
|
||||
use super::types::FileOrStdin;
|
||||
|
||||
use crate::cli::examples;
|
||||
use examples::Action;
|
||||
use examples::Actions;
|
||||
use examples::Example;
|
||||
|
||||
const INSPECT_EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Inspects a certificate.",
|
||||
command: &[
|
||||
"sq", "inspect", "juliet.pgp",
|
||||
],
|
||||
}),
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Shows how the certificate looked on July 21, 2013.",
|
||||
command: &[
|
||||
"sq", "inspect", "--time", "20130721", "juliet.pgp",
|
||||
],
|
||||
}),
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Inspects an encrypted message.",
|
||||
command: &[
|
||||
"sq", "inspect", "message.pgp",
|
||||
],
|
||||
}),
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Inspects a detachted signature.",
|
||||
command: &[
|
||||
"sq", "inspect", "document.sig",
|
||||
],
|
||||
}),
|
||||
]
|
||||
};
|
||||
test_examples!(sq_inspect, INSPECT_EXAMPLES);
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(
|
||||
name = "inspect",
|
||||
@ -24,24 +63,7 @@ of it.
|
||||
`--time` argument. It uses the reference time when determining what
|
||||
binding signatures are active.
|
||||
",
|
||||
after_help =
|
||||
"EXAMPLES:
|
||||
|
||||
# Inspects a certificate
|
||||
$ sq inspect juliet.pgp
|
||||
|
||||
# Inspects a certificate ring
|
||||
$ sq inspect certs.pgp
|
||||
|
||||
# Inspects a message
|
||||
$ sq inspect message.pgp
|
||||
|
||||
# Inspects a detached signature
|
||||
$ sq inspect message.sig
|
||||
|
||||
# Show the certificate as it looked on July 21, 2013
|
||||
$ sq inspect --time 20130721 cert.pgp
|
||||
",
|
||||
after_help = INSPECT_EXAMPLES,
|
||||
)]
|
||||
pub struct Command {
|
||||
#[clap(
|
||||
|
@ -27,3 +27,13 @@ By using static data, we can use known fingerprints in the examples.
|
||||
<juliet@example.org>.
|
||||
|
||||
- NOT imported into the cert store.
|
||||
|
||||
- document.txt, document.sig: A document, and a detached signatured.
|
||||
|
||||
- `sq sign --detached --signer-file juliet-secret.pgp document.txt > document.sig`
|
||||
- `sq verify --signer-file juliet-secret.pgp --detached document.sig document.txt`
|
||||
|
||||
- message.pgp: A document encrypted for Bob, and signed by Alice.
|
||||
|
||||
- `echo 'Golf this afternoon?' | sq encrypt --recipient-file bob-secret.pgp --signer-file alice-secret.pgp > message.pgp`
|
||||
|
||||
|
8
tests/data/examples/document.sig
Normal file
8
tests/data/examples/document.sig
Normal file
@ -0,0 +1,8 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
wr0EABYKAG8FgmXxa5IJEIMEhL2szEMlRxQAAAAAAB4AIHNhbHRAbm90YXRpb25z
|
||||
LnNlcXVvaWEtcGdwLm9yZ231Pyp72PaeRUCoTgZ9zMup1KjxAbUtf8+F6A7iU+2H
|
||||
FiEEzb/YfSE60fznV0XtgwSEvazMQyUAAJyuAQDaJBP7U79ef2jlO9opGRt6+XZh
|
||||
5hk3BFMH6p92SquVuwD+LoAxLQmp+U68U3BVN0R81Ncd1XZ/VwIsbteTEa2KEwQ=
|
||||
=JZw9
|
||||
-----END PGP SIGNATURE-----
|
1
tests/data/examples/document.txt
Normal file
1
tests/data/examples/document.txt
Normal file
@ -0,0 +1 @@
|
||||
Important blah, blah.
|
13
tests/data/examples/message.pgp
Normal file
13
tests/data/examples/message.pgp
Normal file
@ -0,0 +1,13 @@
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
|
||||
wV4DmzPRJwx7LKQSAQdAAk8jBHmefdLXL0uONVPvQtMohp6UJQIJjsvjSjXOiwAw
|
||||
RL1y2eQiIvPflqJ2xbF7x8IP0ZYNLkbZ3ro3nEU699ln3qGJPW0MOfJexvt1Ywoq
|
||||
0sBsAUQdCsck4A8BA6xuwm+JYbnwp7dsT+NL7nzweZjiqxH6n+OpUmVd3TeBfDJq
|
||||
3KT/mhqrs4BEsz/N8KSZMKe/riSS6dLY7HkLp4YlWZVKFWzQWcsqFBsYLjFoNfTh
|
||||
4xC4e7zqH7v2yfpi6yV8m/Yd4G/mQyO3MTmFtM3F74r273rJ/hQQT7+qYbEonLix
|
||||
gDlsZy7r1fp3OCOc8LhQi1iP9Xdguai4/6Kj6sjRCujNCqNcWc8xq+GBrwPr6seh
|
||||
YnCOri0xgQWhbpkV5BWJajDHtqRIVKYSlu7CfYYAFB+83g4UDIIx/kVeeTgF6g8U
|
||||
P2PlN/KmwJeY3vlS6C1mdnrJERjweg0QCvuGxkSE1/oUQCpqX2qSyaru7ku54BrB
|
||||
ykUkC9WZkrEWXJhg+iWc
|
||||
=GVtP
|
||||
-----END PGP MESSAGE-----
|
Loading…
x
Reference in New Issue
Block a user