Commit Graph

307 Commits

Author SHA1 Message Date
Justus Winter
93851b524a
Use the visual idiom for cert, userid pairs when certifying.
- See #486.
2024-12-16 13:09:56 +01:00
Neal H. Walfield
12a47e2121
Revert "Refine sq pki {authenticate,lookup}'s user ID designators."
- This reverts commit cc8657f535.

  - The old semantics were better.
2024-12-16 10:17:12 +01:00
Neal H. Walfield
18800cbfcf
Refine sq key userid revoke's user ID designators.
- Change the semantics of `sq key userid revoke --email` to use a
    user ID with just the specified email address, if the email
    address is part of a self-signed user ID.  That is, use the
    `Exact` semantics instead of the `By` semantics.  For example, if
    a certificate has the self-signed user ID "Alice
    <alice@example.org>", then `--email alice@example.org` would have
    selected "Alice <alice@example.org>" for revocation, but now it
    selects "<alice@example.org>".

  - Add `sq key userid revoke --userid-by-email`, which uses the
    self-signed user ID with the specified email address.  For
    example, if a certificate has the self-signed user ID "Alice
    <alice@example.org>", then `--userid-by-email alice@example.org`
    selects "Alice <alice@example.org>" for revocation.

  - Fixes #212.
2024-12-15 02:36:01 +01:00
Neal H. Walfield
d756753950
Refine sq pki vouch {add,authorize}'s user ID designators.
- Change the semantics of `sq pki vouch add --email` and `sq pki
    vouch authorize --email` to use a user ID with just the specified
    email address, if the email address is part of a self-signed user
    ID.  That is, use the `Exact` semantics instead of the `By`
    semantics.  For example, if a certificate has the self-signed user
    ID "Alice <alice@example.org>", then `--email alice@example.org`
    would have selected "Alice <alice@example.org>" for certification,
    but now it selects "<alice@example.org>".

  - Add `sq pki vouch add --userid-by-email`, and `sq pki vouch
    authorize --userid-by-email`, which use the self-signed user ID
    with the specified email address.  For example, if a certificate
    has the self-signed user ID "Alice <alice@example.org>", then
    `--userid-by-email alice@example.org` selects "Alice
    <alice@example.org>" for certification.

  - Fixes #212.
2024-12-15 02:31:21 +01:00
Neal H. Walfield
cc8657f535
Refine sq pki {authenticate,lookup}'s user ID designators.
- Change the semantics of `sq pki authenticate --email` and `sq pki
    lookup --email` to use a user ID with just the specified email
    address.  That is, use the `Exact` semantics instead of the `By`
    semantics.  For example, if a certificate has the user ID "Alice
    <alice@example.org>", then `--email alice@example.org` does not
    select it.

  - Add `sq pki authenticate --userid-by-email`, and `sq pki lookup
    --userid-by-email`, which match user IDs with the specified email
    address.  For example, if a certificate has the user ID "Alice
    <alice@example.org>", then `--userid-by-email alice@example.org`
    selects it.

  - Fixes #212.
2024-12-15 02:31:08 +01:00
Neal H. Walfield
67f8bd2876
Refine sq pki link retract's user ID designators.
- Add `sq pki link retract --userid-by-email`, which selects a
     self-signed user ID with the specified email address.
2024-12-15 01:32:34 +01:00
Neal H. Walfield
18b5cbda4d
Refine sq pki link {add,authorize}'s user ID designators.
- Change the semantics of `sq pki link add --email` and `sq pki
    link authorize --email` to use a user ID with just the specified
    email address, if the email address is part of a self-signed user
    ID.  That is, use the `Exact` semantics instead of the `By`
    semantics.  For example, if a certificate has the self-signed user
    ID "Alice <alice@example.org>", then `--email alice@example.org`
    would have selected "Alice <alice@example.org>" to link, but now
    it selects "<alice@example.org>".

  - Add `sq pki link add --userid-by-email`, and `sq pki link
    authorize --userid-by-email`, which use the self-signed user ID
    with the specified email address.  For example, if a certificate
    has the self-signed user ID "Alice <alice@example.org>", then
    `--userid-by-email alice@example.org` selects "Alice
    <alice@example.org>" to link.

  - Fixes #212.
2024-12-15 01:32:33 +01:00
Justus Winter
b85dc35f5d
Gracefully handle unencrypted Autocrypt messages.
- Only show the warnings in verbose mode, and turn the error into a
    warning.

  - Fixes #503.
2024-12-14 19:12:19 +01:00
Julian Andres Klode
5adb325f88
Do not hide errors from keyrings in verify.
- Fixes #492.

Signed-off-by: Julian Andres Klode <jak@debian.org>
2024-12-14 16:12:15 +01:00
Neal H. Walfield
8ccb13db20
Rename --userid-or-add to --add-userid, etc.
- Rename `--userid-or-add`, `--email-or-add`, and `--name-or-add`
    respectively to `--add-userid`, `--add-email`, and `--add-name`.

  - These names more closely match their new semantics: they don't
    first try and match a self-signed user ID, but just use a user ID
    consisting of the argument's value.
2024-12-14 00:00:46 +01:00
Neal H. Walfield
c0ef0f5dbd
Extend and adjust the set of user ID designators.
- Rename the `Exact` designator semantics to `By`.  By default, the
    `By` arguments are called `--userid`, `--userid-by-email`, and
    `--userid-by-name`.

  - Add a new set of designators called `Exact` for the arguments
    `--userid`, `--email`, and `--name`.  The semantics of `Exact`
    are: the value must match a self-signed user ID, however, the
    returned user ID is just the value, not the matching self-signed
    user ID.  That is, if there is a self-signed user ID `Alice
    <alice@example.org>`, `--email alice@example.org` matches and
    returns the user ID `<alice@example.org>`, and `--name Alice`
    returns the user ID `Alice`.

  - Change the semantics of `Add` user ID designators (by default,
    `--userid-or-add`, `--email-or-add`, and `--name-or-add`) so that
    they just return a user ID with just the specified value.  That is
    `--email alice@example.org` returns the user ID
    `<alice@example.org>`.

  - The following commands use user ID designators and their semantics
    are unchanged:

    - `sq key approvals list`: Unchanged.
    - `sq key approvals update`: Unchanged.
    - `sq pki authenticate`: Unchanged.
    - `sq pki lookup`: Unchanged.
    - `sq pki path`: Unchanged.

  - The following commands use user ID designators and their semantics
    changed as follows:

    - `sq pki link add`: `--email-or-add` had the old `Add` semantics
      and now has the new `Add` semantics.

    - `sq pki link authorize`: `--email-or-add` had the old `Add`
      semantics and now has the new `Add` semantics.

    - `sq pki link retract`: `--email` had the old `Add` semantics and
      now has the new `Add` semantics.

    - `sq key userid revoke`: `--email-or-add` had the old `Add` semantics and
      now has the new `Add` semantics.

    - `sq key vouch add`: `--email-or-add` had the old `Add` semantics and
      now has the new `Add` semantics.

    - `sq key vouch authorize --email-or-add` had the old `Add`
      semantics and now has the new `Add` semantics.
2024-12-13 22:53:00 +01:00
Justus Winter
c60a2d33fb
Fix test.
- Give Sequoia a little space to backdate the signatures.  Note:
    It will not backdate them past the key creation time.
2024-12-13 17:01:38 +01:00
Neal H. Walfield
1a8dd3e467
Better handle user ID's matched by --all.
- Change `sq pki link add`, `sq pki link authorize`, `sq pki link
    retract`, `sq pki vouch add`, and `sq pki vouch authorize` to
    better handle unusable user IDs matched by `--all`.  Specifically,
    if the user explicitly designates a user ID and we can't use it,
    then fail loudly, but if a user ID is selected by `--all` and it
    not usable, only emit a warning.
2024-12-13 14:31:31 +01:00
Neal H. Walfield
d830691779
Fix test for sq pki link retract.
- Fix the user ID designator test for `sq pki link retract`.  It
    didn't actually test `sq pki link retract`.
2024-12-13 14:31:31 +01:00
Justus Winter
09882042b1
Make sq cert list display certificates without user IDs.
- If a cert has been explicitly given via the cert designators, we
    want to display it even if it has no bindings.

  - Fixes #501.
2024-12-12 16:51:05 +01:00
Neal H. Walfield
5079c8ee66
Add tests for sq key approvals update.
- Test that the user ID designators behave correctly.
2024-12-12 10:47:05 +01:00
Neal H. Walfield
29329e5dec
tests: Improve sq key approvals update help functions.
- Adjust the API for `Sq::key_approvals_update` and add
    `Sq::try_key_approvals_update`.
2024-12-12 10:47:04 +01:00
Neal H. Walfield
e227aecbc2
Add tests for sq key approvals list.
- Test that the user ID designators behave correctly.
2024-12-12 10:47:04 +01:00
Neal H. Walfield
52fdea48e2
Add tests for sq key userid revoke.
- Test that the user ID designators behave correctly.
2024-12-12 10:47:04 +01:00
Neal H. Walfield
9564c5cf99
Add tests for sq pki lookup.
- Test that the user ID designators behave correctly.
2024-12-12 10:47:04 +01:00
Neal H. Walfield
551084b560
Add tests for sq pki authenticate.
- Test that the user ID designators behave correctly.
2024-12-12 10:47:04 +01:00
Neal H. Walfield
4e5dcba9b1
Add tests for sq pki vouch {add,authorize}.
- Test that the user ID designators behave correctly.
2024-12-12 10:47:04 +01:00
Neal H. Walfield
aa031eaf7c
tests: Rename Sq::pki_vouch_authorize_p.
- Rename `Sq::pki_vouch_authorize_p` to
    `Sq::try_pki_vouch_authorize`.
2024-12-12 10:47:03 +01:00
Neal H. Walfield
5c11414386
tests: Simplify Sq::try_pki_vouch_add and Sq::pki_vouch_authorize_p.
- Remove the `success` parameter from `Sq::try_pki_vouch_add` and
    `Sq::pki_vouch_authorize_p` and just propagate any error to the
    caller.  This is more consistent with the rest of the functions.
2024-12-12 10:47:03 +01:00
Neal H. Walfield
a979d343a2
Add tests for sq pki link retract.
- Test that the user ID designators behave correctly.
2024-12-12 10:47:03 +01:00
Neal H. Walfield
2dac8e6253
Add tests for sq pki link authorize.
- Test that the user ID designators behave correctly.
2024-12-12 10:47:03 +01:00
Neal H. Walfield
69d85bf3d4
Add tests for sq pki link add.
- Test that the user ID designators behave correctly.
2024-12-12 10:47:03 +01:00
Justus Winter
830c49def0
Require explicit opt-out for encrypting without signing.
- Fixes #459.
2024-12-11 17:29:36 +01:00
Justus Winter
ebef0cf9ee
Use cert designators for sq cert list.
- This aligns it with `sq key list` and `sq pki link list`.

  - Fixes #446.
2024-12-11 16:24:43 +01:00
Justus Winter
02f0dc44fa
Fix generation of user ID-less keys.
- Fixes #491.
2024-12-11 13:29:32 +01:00
Justus Winter
7397a8a440
Make sq pki link list fail if a designated cert has no link.
- Fixes #484.
2024-12-04 14:04:22 +01:00
Justus Winter
660d1eb39d
Align sq sign --detached-file with sq verify --detached-file.
- `sq sign --signature-file` now takes a value specifying where the
    signature should be written to.  It conflicts with `--output`.
    This aligns `sq sign` with `sq verify`.

  - Fixes #444.
2024-12-04 12:22:47 +01:00
Neal H. Walfield
f0e73deb7f
Add tests for sq pki link list.
- Add tests that check that `sq pki link list` returns an
    appropriate error code.

  - See #484.
2024-12-04 11:22:23 +01:00
Neal H. Walfield
0cc2aba0be
Add tests for sq key list.
- Add tests that check that `sq key list` returns an appropriate
    error code.
2024-12-04 11:22:20 +01:00
Neal H. Walfield
fde96e5790
Listing an empty certificate store should not be an error.
- `sq cert list` on an empty certificate store should not be an
    error.
2024-12-04 11:15:13 +01:00
Neal H. Walfield
61e3b67505
Change sq pki link add, etc. to use stdout.
- Change `sq pki link add`, `sq pki link authorize`, `sq pki link
    retract` to use `stdout`, not `stderr`, for their main output.

  - See #342.
2024-12-03 18:59:37 +01:00
Neal H. Walfield
a2beb96123
Change sq cert list, sq pki authenticate, etc. to use stdout.
- Change `sq cert list`, `sq pki authenticate`, `sq pki lookup`, `sq
    pki identify`, and `sq pki path` to use `stdout`, not `stderr`, for
    their main output.

  - See #342.
2024-12-03 18:59:36 +01:00
Justus Winter
012e762d38
Align user ID designators in sq pki link retract.
- User IDs have to be explicitly given, or `--all` has to be used to
    select them all (this was previously the default).

  - This aligns the retract subcommand with the other link and vouch
    management commands.

  - Fixes #442.
2024-11-28 18:07:30 +01:00
Neal H. Walfield
c9bde7fe47
Add support for addressing shadow CAs by symbolic names.
- Add a new paramter to `sq pki link add`, `sq pki link authorize`,
    and `sq pki link retract`, `--cert-special`, which allows addressing
    shadow CAs by symbolic names.

  - If the shadow CA doesn't exist yet, we create it.

  - This means `sq pki link authorize --cert-special keys.openpgp.org
    --all --unconstrained` can be used to fully trust the
    `keys.openpgp.org` key server, for instance.  This is more
    convenient, and especially useful for documentation.

  - Fixes #337.
2024-11-28 15:38:34 +01:00
Justus Winter
9f5c5ce930
Mark sq keyring filter experimental.
- Invoking it now requires the `--experimental` flag.  This is a
    template that we may use to introduce features into sq with a bit
    of a chance to stabilize it over time.

  - Fixes #455.
2024-11-27 17:27:04 +01:00
Justus Winter
3b1bd79195
Align user ID designators in sq pki {link,vouch} {add,authorize}.
- Align user ID designators across these four commands.  Previously,
    `--all` was implied for the authorize commands if no user ID
    designator was given.

  - However, this is problematic for the following reasons:

    - First, it is inconsistent across the commands.

    - Second, while CAs can add any name to their cert because they
      are CAs, those certifications are subject to constraints, such
      as domain constraints, or the amount.  But, the link we add
      fully authenticates the current user IDs, which may not be what
      the user wants, so it should require explicit consent.

    - Third, making this implicit again is easier than going from
      implicit to explicit, which breaks existing users.

  - Fixes #442.
2024-11-27 13:33:30 +01:00
Neal H. Walfield
be5b1f7103
Change sq pki link retract to use the NULL policy.
- Change `sq pki link retract` to use the NULL policy when resolving
    user IDs.  It's safer to retract a link for a user ID than to
    refuse.
2024-11-24 22:01:06 +01:00
Neal H. Walfield
bfc843bc52
To revoke a user ID, require the cert be valid under the current policy.
- Change `sq key userid revoke` to require the certificate be valid
    under the current policy.  If the certificate is not valid under
    the current policy, the user should revoke the whole certificate,
    or fix it using `sq cert lint` after verifying the certificate's
    integrity.  If the certificate is valid under the current policy,
    but the user ID to revoke isn't, it can still be revoked using
    `--userid-or-add`.

  - See #375.
2024-11-23 20:38:21 +01:00
Neal H. Walfield
c51e657fcc
tests: Add more tests for sq encrypt. 2024-11-23 12:15:17 +01:00
Neal H. Walfield
258394678f
Don't use revoked certificates for encryption.
- Change `sq encrypt` to not use revoked certificates.
2024-11-23 12:14:56 +01:00
Neal H. Walfield
d5c4c50326
Make sq key password change the password of weakly bound keys.
- Change `sq key password` to also change the password of keys that
    are weakly bound.  Users are likely to be more surprised when a
    password is not changed.
2024-11-22 17:47:41 +01:00
Neal H. Walfield
493ab3ab31
tests: Add tests for sq key password. 2024-11-22 17:20:17 +01:00
Neal H. Walfield
0c5e0c9487
Improve how sq key delete handles ambiguous associations.
- Change `sq key delete` to fail if a key is associated with
    multiple certificates.

  - Fixes #457.
2024-11-22 16:03:20 +01:00
Neal H. Walfield
569a5fa5f9
Change sq key {delete,password} to work with more certificates.
- `sq key delete` and `sq key password` fail if any of the keys are
    missing secret key material.

  - Change them to work with the available secret key material.  (But
    if there is none, still fail.)
2024-11-22 16:01:38 +01:00
Neal H. Walfield
faa350b694
Change sq key delete to refuse to work with weakly bound subkeys.
- `sq key delete` deletes all secret key material associated with a
    certificate.  Of course, we don't want to delete secret key
    material that we are not confident belongs to the certificate.

  - Imagine Alice creates a new certificate.  Mallory see this, and
    anticipates that she is going to delete the old certificate.  He
    attaches her new encryption-capable subkey to the old certificate
    using some weak cryptography, publishes it, and then Alice gets
    the update to her old certificate via parcimonie.  When she
    deletes the secret key material associated with the old
    certificate, she would also delete her new secret key material.
    Ouch!  Admittedly, this attack is a bit contrived.

  - Alternatively, we could skip subkeys whose bindings rely on
    weak cryptography.  This behavior would probably surprise most
    users.  It could have serious consequences as well, since the
    user thought they deleted the secret key material, but didn't.

  - Instead, we are conservative: if a subkey's binding signature
    relies on weak cryptography AND we have secret key material for
    it, we abort, and suggest using `sq key subkey delete` instead.

  - See #375 and #457.
2024-11-22 16:01:02 +01:00