Commit Graph

157 Commits

Author SHA1 Message Date
Neal H. Walfield
b266d9dea1
Add a unit test for sq key subkey expire for unbound subkeys.
- Check that `sq key subkey expire` won't extend the expiration of a
    subkey that isn't bound.

  - Improve the error message when this happens.
2024-10-08 11:42:27 +02:00
Neal H. Walfield
7292c6c347
Fix setting a certificate's expiration time.
- When setting a certificate's expiration time, we update each user
    ID's self signature.  If a user ID is revoked, creating a new self
    signature will "unrevoke it."

  - Skip user IDs that are revoked.
2024-10-08 10:52:33 +02:00
Neal H. Walfield
9a2f2bc72b
Fix setting a certificate's expiration time.
- When setting a certificate's expiration time, we update the
    direct key signature, and each user ID's self signature.  This
    fails if a user ID doesn't have a valid self signature.

  - User IDs, however, don't need to be self signed!  For instance, a
    user ID may only have a third-party certification.

  - Relax `sq key expire` to only add a self signature for a user ID,
    if the user ID already has a self signature.
2024-10-08 09:30:51 +02:00
Justus Winter
43edb2c190
Add missing example data file bob.pgp.
- The README mentions it, but it is missing.
2024-10-07 15:27:28 +02:00
Neal H. Walfield
fd35509784
Don't call exit, just return an error.
- Never call `exit`.  If there is an error, propagate the error to
    the caller.  This ensures that any clean up handlers (like
    flushing state to disk) are run.
2024-10-07 13:28:24 +02:00
Justus Winter
20df76538e
Rename sq encrypt --recipient to sq encrypt --for`.
- Fixes #356.
2024-10-04 11:54:53 +02:00
Justus Winter
ba121b2339
Rename --recipient-cert to --recipient.
- Fixes #355.
2024-10-04 11:16:33 +02:00
Justus Winter
20fb370de7
Rename --signer-key to --signer.
- See #355.
2024-10-04 11:16:24 +02:00
Justus Winter
dff6664f47
Rename the global --force flag to --overwrite.
- This flag now only controls whether existing files are
    overwritten.

  - Fixes #31.
2024-10-02 18:42:31 +02:00
Justus Winter
63ae7dbb8c
Rename sq verify --detached to sq verify --signature-file.
- Fixes #255.
2024-10-02 17:37:35 +02:00
Justus Winter
535164b7af
Fix changing the expiration time on keys without direct key sig.
- Fixes #230.
2024-10-02 17:10:43 +02:00
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
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
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
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
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
e2d5bc1de4
Move sq key userid strip to sq toolbox strip-userid.
- Fixes #306.
2024-09-16 16:16:32 +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
Justus Winter
2c4ecbb41e
Align sq key subkey expire and sq key subkey revoke.
- Make the latter take a named --key argument that can be given
    multiple times.

  - Fixes #329.
2024-09-16 15:01:24 +02:00
Justus Winter
6034e03893
Avoid using the system-wide crypto policy in tests.
- Fixes #177.
2024-09-16 12:53:33 +02:00
Justus Winter
cc707466d3
Remove output format and version command line options.
- See #310.

  - Fixes #289.
2024-09-02 14:47:42 +02:00
Justus Winter
9d72502512
Port remaining tests to the common test framework. 2024-09-02 13:23:28 +02:00
Justus Winter
bbfdebfd73
Rename sq encrypt --symmetric to --with-password.
- This is an ugly gpgism.  All encrypted messages are symmetrically
    encrypted.  Not all password-encrypted messages encrypt the
    session key symmetrically.  Use language the user understands.

  - Fixes #331.
2024-09-02 11:47:56 +02:00
Justus Winter
13c7d5a83b
Implement sq encrypt --symmetric-password-file.
- Fixes #271.

  - Fixes #58.
2024-09-02 11:43:48 +02:00
Justus Winter
fc273e89d4
Implement sq key subkey add --new-password-file.
- See #271.
2024-09-02 11:41:04 +02:00
Justus Winter
ca6a68ba8a
Parallelize the subkey password test. 2024-09-02 10:22:21 +02:00
Justus Winter
0cf495bd90
Implement sq key generate --new-password-file.
- See #271.
2024-09-02 10:16:33 +02:00
Justus Winter
dd5ee688fb
tests: Port remaining tests to the test framework. 2024-08-30 14:33:00 +02:00
Justus Winter
945757684c
Fix terminology. 2024-08-29 13:20:03 +02:00
Justus Winter
8f33b87216
Implement sq --batch for non-interactive use.
- Fixes #267.
2024-08-29 13:20:03 +02:00
Justus Winter
8bafdd847f
tests: Remove extra layer of modules. 2024-08-29 13:20:03 +02:00
Justus Winter
4702fe8e36
Improve sq key approvals update.
- Add user ID selectors, allow approving or disapproving by
    certifier fingerprint, and approving using the Web of Trust.

  - Fixes #262.
2024-08-28 09:19:38 +02:00
Neal H. Walfield
bf056997a9
Rename integration tests to match the subcommand being tested.
- Rename the files and the tests to reflect the subcommands actually
    being tested.
2024-08-22 11:30:26 +02:00
Neal H. Walfield
cee60e89df
Make sq cert export more consistent with other commands.
- Unlike other commands, `sq cert export`'s `--cert` argument only
    matches on the certificate's key handle (i.e., the primary key's
    key handle).  It also has a `--key` argument to match on the
    primary key's key handle or a subkey's key handle, which are
    the semantics of the `--cert` argument for other commands.

  - Change the semantics of `--cert` to that of `--key`, i.e., change
    `--cert` to also match on subkey key handles.  Remove the `--key`
    argument since it is now redundant.
2024-08-22 11:13:54 +02:00
Justus Winter
05dc2f85c5
Update description of the assets used in the examples. 2024-08-16 17:49:55 +02:00
Justus Winter
c94fb2249d
Improve the way we make the subplot tests opt-in.
- Promote subplotlib to a proper dependency, as dev-dependencies can
    not be optional.
2024-08-15 14:16:26 +02:00
Justus Winter
9b16970655
Drop the "integration" module from the integration tests. 2024-08-15 14:05:24 +02:00
Justus Winter
a470f5946d
Consolidate all integration tests.
- This way they only have to be compiled once, and can all be run
    concurrently.
2024-08-15 13:38:43 +02:00