Commit Graph

804 Commits

Author SHA1 Message Date
Justus Winter
fe2a003c7d
Rename sq key subkey adopt to bind, improve documentation.
- This is to emphasize that the key is copied, not moved.

  - Fixes #332.
2024-10-02 15:51:07 +02:00
Justus Winter
cb664239bc
Move sq key adopt to sq key subkey adopt.
- Fixes #301.
2024-10-02 15:14:31 +02:00
Justus Winter
f17411ac2d
Improve warning message.
- Fixes #341.
2024-10-02 14:36:47 +02:00
Justus Winter
dabeccfd60
Port the examples of sq toolbox packet to the examples framework. 2024-10-02 14:28:26 +02:00
Justus Winter
aaa3732764
Improve and fix the documentation of sq toolbox packet split.
- Fixes #345.
2024-10-02 14:28:12 +02:00
Justus Winter
fa34d331e1
Fix splitting and joining packets with bodies, such as literals. 2024-10-02 13:22:37 +02:00
Justus Winter
6aff1a905c
Improve the file names when splitting packet streams.
- Fixes #346.
2024-10-02 12:47:40 +02:00
Justus Winter
19ed168dff
Emit a hint when trying to sq key import a certificate.
- Fixes #347.
2024-10-02 12:38:52 +02:00
Justus Winter
0710d4d2c7
Deduplicate subkey arguments when revoking subkeys.
- Fixes #348.
2024-10-02 12:17:30 +02:00
Justus Winter
a2440d7cf0
Introduce a switch to select the type of DNS resource records.
- Fixes #353.
2024-10-02 11:31:19 +02:00
Justus Winter
b4158f40de
Fix adopting subkeys backed by the softkeys backend into softkeys.
- Fixes #333.
2024-09-27 17:51:52 +02:00
Justus Winter
d4a6b09b45
Allow source certs to be ambiguous when adopting a key. 2024-09-27 17:32:26 +02:00
Justus Winter
f448fcb347
Avoid file descriptor exhaustion when fetching certificates.
- Previously, there was a chance of running out of file descriptors
    while or after fetching a large number of certificates using sq
    network fetch.

  - The root cause of that was the use of getaddrinfo(3) to resolve
    names, which is a blocking interface, which has to be executed on
    a special thread for blocking tasks on the tokio runtime.  The
    maximum number of these threads is capped at 512 by default, and
    these threads can tie up a significant number of file descriptors
    in sockets.  The threads do close their sockets and go away after
    a while, presumably after a timeout.  Further, blocking tasks can
    not be canceled.

  - Do release all thread pool resources after doing the fetch.

  - Also, switch to the hickory crate for doing name lookups.  This
    implements a non-blocking interface, and releases resources in a
    timely fashion.

  - Fixes #335.
2024-09-27 13:34:31 +02:00
Justus Winter
8468817010
Disregard bad information in the signers user ID subpacket.
- Fixes #148.
2024-09-26 17:59:17 +02:00
Justus Winter
fad2d75de2
Use the cert fingerprint in messages, not the signing subkeys keyID.
- Fixes #340.
2024-09-26 16:42:50 +02:00
Justus Winter
471e1c7c5a
Fix hints.
- Don't suggest to link the issuer (sub)key, always use the cert
    fingerprint.

  - Fixes #278.
2024-09-26 16:42:50 +02:00
Neal H. Walfield
6477009a78
Bump MSRV to 1.75.
- `rustc` version 1.75 has entered Debian Trixie.  Bump our MSRV
    accordingly.
2024-09-26 16:02:32 +02:00
Neal H. Walfield
60892e6cee
Remove redundant long_about.
- If `long_about` is not set, `about` is used.  Since they are the
    same, remove `long_about`.
2024-09-26 16:00:29 +02:00
Neal H. Walfield
1348398e27
Fix hint. 2024-09-26 16:00:29 +02:00
Neal H. Walfield
0cb7f36162
Fix long about strings so that they line wrap.
- Line wrapping works on a line-by-line basis, not a paragraph
    basis.  As such, we need to escape newlines in order for line
    wrapping to work.
2024-09-26 16:00:29 +02:00
Neal H. Walfield
ed440f33f4
Escape newlines in help text to enable automatic line wrapping. 2024-09-26 16:00:29 +02:00
Neal H. Walfield
cc0598078c
Fix spelling. 2024-09-26 16:00:28 +02:00
Justus Winter
db4986e7df
Don't dump bad signatures by default, add CLI switch for that.
- Fixes #244.
2024-09-26 15:41:17 +02:00
Justus Winter
8b391314e3
Dump bad signatures. 2024-09-26 15:41:17 +02:00
Justus Winter
61f790c12c
Rework indentation in the inspect module. 2024-09-26 15:41:17 +02:00
Justus Winter
d02541558a
Refactor signature dumping. 2024-09-26 15:41:17 +02:00
Justus Winter
c3a7546120
Refactor key dumping. 2024-09-26 15:41:17 +02:00
Neal H. Walfield
99689fd405
When adopting a key, if the creation time is unset, set it.
- When adopting a bare key, the creation time is the Unix epoch.
    If the user doesn't manually override this using
    `--creation-time`, use the current time (while respecting
    `--time`).
2024-09-26 13:07:28 +02:00
Neal H. Walfield
6451e0416f
Add the --creation-time argument to sq key adopt.
- Add an argument to `sq key adopt`, `--creation_time`, to allow the
    user to override the key's creation time.
2024-09-26 13:06:34 +02:00
Neal H. Walfield
33dc4a1b41
When adopting a key, error out if the key's key flags is empty.
- When adopting a key using `sq key adopt`, error out if the key's
    key flags are empty.
2024-09-26 13:05:36 +02:00
Neal H. Walfield
5ec89e8abe
Allow modifying the key flags when adopting a key.
- Add `--can-sign`, `--cannot-sign`, `--can-authenticate`,
    `--cannot-authenticate`, `--can-encrypt`, `--cannot-encrypt` to `sq
    key adopt`, which modify the key flags of the adopted key.
2024-09-26 13:05:36 +02:00
Neal H. Walfield
331da9d600
Don't require a key being adopted to have a binding signature.
- Change `sq key adopt` to not require the key that is being adopted
    to have a binding signature.

  - This allows adopting "bare keys," i.e., a certificate consisting
    of just a primary key.  Bare keys are useful when working with raw
    keys, e.g., keys generated on an OpenPGP card, a TPM device, etc.
    To add them to a certificate, they just need to be wrapped in a
    minimal amount of OpenPGP framing; no signatures are required.

  - Fixes #25.
2024-09-26 13:05:36 +02:00
Neal H. Walfield
726dedc553
Make the test helper function Sq::key_adopt more consistent.
- Make `Sq::key_adopt` more consistent with other functions by
    providing an `Sq::key_adopt_maybe` version, which panics on failure.
2024-09-26 09:43:44 +02:00
Neal H. Walfield
ce59c45165
Simplify how tests call sq key adopt.
- Remove rarely used arguments from `Sq::key_adopt`.  They can be
    provided via the `extra_args` argument when needed.
2024-09-26 09:34:35 +02:00
Neal H. Walfield
c610ba19fa
Allow tests to pass addition arguments to sq key adopt.
- Add an argument to `Sq::key_adopt`, `extra_args`, to allow tests
    to pass additional, arbitrary arguments to `sq key adopt`.
2024-09-26 09:20:50 +02:00
Neal H. Walfield
048be9c08c
Tighten the sq encrypt tests.
- When designating a certificate multiple times, the certificate
    should only be used once.  Assert that this is the case in the `sq
    encrypt` tests by checking that the PKESKs are not redundant.

  - Note: this was fixed by 437ae24.
2024-09-25 13:16:27 +02:00
Neal H. Walfield
437ae24917
Switch sq encrypt to the certificate designator abstraction.
- Use `CertDesignators` to expose `sq encrypt`'s certificate
    designator arguments.
2024-09-25 13:15:57 +02:00
Neal H. Walfield
d8ad8dcd42
Switch sq cert export to the certificate designator abstraction.
- Use `CertDesignators` to expose `sq cert export`'s certificate
    designator arguments.
2024-09-25 13:15:57 +02:00
Neal H. Walfield
9a46a12a79
Fix sq cert export test vector.
- A `sq cert export` test vector specified `--email
    carol@example.org`, which doesn't match any certificates.  The error
    was hidden, because we were not strict about ensuring that all
    certificate designators actually match at least one certificate.

  - Fix the test vector.
2024-09-25 13:15:57 +02:00
Neal H. Walfield
16aaab33b9
Add a certificate designator abstraction.
- Add a new type, `CertDesignators`, which can be flattened into a
    clap subcommand, and exposes one or more certificate designator
    arguments (`--file`, `--cert`, `--userid`, `--userid`, `--domain`,
    and `--grep`) with an optional prefix (e.g., it transforms `--file`
    into `--cert-file`).

  - See #207.
2024-09-25 13:15:57 +02:00
Neal H. Walfield
0592a4041b
Add a test for sq encrypt for revoked subkeys.
- Add a test for `sq encrypt` that checks that an attempt to use
    a revoked subkey results in an error.
2024-09-25 13:15:57 +02:00
Neal H. Walfield
b8d02f2216
Add a test for sq encrypt for expired subkeys.
- Add a test for `sq encrypt` that checks that an attempt to use
    an expired subkeys results in an error unless
    `--use-expired-subkey` is provided.
2024-09-25 13:15:46 +02:00
Neal H. Walfield
5bc7a81045
Add a test for sq encrypt for non-encryption-capable certifications.
- Add a test for `sq encrypt` that checks that an attempt to use
    a certificate that is not encryption-capable results in an error.
2024-09-25 13:15:32 +02:00
Neal H. Walfield
3965167ac0
Add a test for sq encrypt's certificate designators.
- Add a test for `sq encrypt` that checks that the different ways of
    designating a certificate work including making sure that only
    authenticated names can be used to designate a certificate.
2024-09-25 13:09:58 +02:00
Neal H. Walfield
42f43f656e
Port sq_encrypt.rs to the common test framework. 2024-09-25 12:18:44 +02:00
Justus Winter
f88b433d8b
Move implementation, add NEWS entry.
- Fixes e2d5bc1de4.
2024-09-24 15:10:29 +02:00
Justus Winter
e2d5bc1de4
Move sq key userid strip to sq toolbox strip-userid.
- Fixes #306.
2024-09-16 16:16:32 +02:00
Neal H. Walfield
9cfc2e9a16
Make sq key expire more robust.
- When updating a component's expiration, we collect the new self
    signatures in a vector, append them to the certificate using
    `Cert::insert_packets`, and rely on canonicalize to reorder them.

  - To make reordering simpler and more robust (see issue #1125 in
    sequoia-openpgp), precede the new self signature by a copy of the
    component.

    https://gitlab.com/sequoia-pgp/sequoia/-/issues/1125
2024-09-16 15:35:54 +02:00
Neal H. Walfield
292b32fc65
Improve debugging output. 2024-09-16 15:35:54 +02:00
Neal H. Walfield
910edc96f6
Add a convenience function to preserve a test's state.
- Add `Sq::preserve` to prevent the files created by an `Sq`
    instance from being deleted when the `Sq` instance is dropped.

  - Preserving the state makes it easier to debug a test that is
    failing.
2024-09-16 15:35:47 +02:00