Commit Graph

272 Commits

Author SHA1 Message Date
Neal H. Walfield
a9d419973c
Check that we don't certify our own certificate.
- `sq pki certify` and `sq pki authorize` are for creating
    third-party certifications.

  - Error out if the certifier is the same as the certificate being
    certified.
2024-10-15 12:55:56 +02:00
Neal H. Walfield
f11b3f6b59
Extend sq pki authorize to constrain by domain.
- Constraining an introducer by regex is error prone.  Add an option
    to `sq pki authorize` to constrain an introducer by domain name.
2024-10-14 17:46:18 +02:00
Neal H. Walfield
22284ed9b1
Add new subcommand sq pki authorize.
- Previously `sq pki certify` could create certifications, and mark
    a certificate as a trusted introducer (when the user set `--depth`
    to be greater than zero).  Anecdotal evidence indicates that
    combining these two actions in a single command is confusing.

  - Split the latter functionality off, and put it in a new subcommand,
    `sq pki authorize`.

  - See https://gitlab.com/sequoia-pgp/sequoia-sq/-/issues/249#note_1865470753
2024-10-14 17:46:18 +02:00
Neal H. Walfield
bea0a5b732
Generalize Sq::pki_certify to certify multiple user IDs at once.
- Generalize `Sq::pki_certify` to certify multiple user IDs at once.
2024-10-14 17:46:18 +02:00
Neal H. Walfield
3d63b8de96
Change sq pki certify to use a named argument for the certificate.
- `sq pki certify` uses a positional argument to specify the
    certificate to certify.  Change it to be a named argument, either
    `--cert`, or `--cert-file`.

  - See #318.
2024-10-14 17:46:12 +02:00
Neal H. Walfield
b40f545a24
Change sq pki certify to use a named argument for the user ID.
- `sq pki certify` uses a positional argument to specify the user
    ID to certify.  Change it to be a named argument, either
    `--userid`, or `--email`.

  - This changes the meaning of `--email` from a flag that changes how
    `--userid` interprets its argument, to an argument.

  - This also allows multiple user IDs to be specified at once.

  - See #318.
2024-10-14 17:13:08 +02:00
Neal H. Walfield
4a3c360f41
Refactor sq pki certify, sq pki link add and sq pki link retract.
- Pull similar functionality out of the implementation of `sq pki
    certify`, `sq pki link add`, and `sq pki link retract`, and put it
    in a new module, `common::pki::certify`.

  - This slightly changes the human readable output.
2024-10-14 17:13:08 +02:00
Justus Winter
aaae90ce6e
Improve some integration tests to use more of the test framework. 2024-10-11 16:53:54 +02:00
Justus Winter
b885328662
Make sq toolbox keyring filter --handle robust.
- By splitting `--handle` into `--cert` and `--key`, where the
    former only matches on primary keys, and the latter matches on
    both primary keys and subkeys.

  - Fixes #287.
2024-10-09 16:58:04 +02:00
Justus Winter
d4ce7ac095
Add tests for sq toolbox keyring filter. 2024-10-09 16:57:48 +02:00
Justus Winter
fcfbfb73b6
Run tests in a separate working directory.
- This way they can create artifacts in their working directory.
2024-10-09 16:57:48 +02:00
Justus Winter
0e5b1c0611
Deduplicate function to locate test artifacts. 2024-10-09 16:57:48 +02:00
Neal H. Walfield
62d7813900
Change sq pki certify to reject expired and revoked certs.
- It was possible to use `--allow-not-alive-certifier` and
    `--allow-revoked-certifier` to force `sq pki certify` to use
    expired and revoked certificates.

  - Consistent with the principle that `sq` should support a lot, but
    not everything, remove them.

  - Fixes #365.
2024-10-09 14:57:02 +02:00
Neal H. Walfield
5e80d02b5e
Don't extend the expiration of subkeys that are hard revoke.
- If a subkey is hard revoked, refuse to extend the expiration.
2024-10-08 11:46:07 +02:00
Neal H. Walfield
7862c1609f
Add a unit test for sq key subkey expire for soft revocations.
- Check that `sq key subkey expire` extends the expiration of a
    subkey that is soft revoked.
2024-10-08 11:42:33 +02:00
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
Justus Winter
bd6313df7f
Make sq key userid strip operate on the cert store.
- Fixes #6.
2024-08-15 13:02:48 +02:00
Justus Winter
83f81b5765
Add test for sq key userid strip. 2024-08-15 13:02:37 +02:00
Neal H. Walfield
cd8283d851
Prompt for a password by default.
- Change `sq key generate` and `sq key subkey add` to prompt for a
    password by default.

  - Fixes #226.
2024-08-14 18:19:14 +02:00
Neal H. Walfield
93344e71a6
New subcommand sq key subkey export.
- `sq key export` can either export all keys associated with a
    certificate or individual keys.

  - Split the subkey-related functionality out of `sq key export` and
    into the new subcommand `sq key subkey export`

  - Fixes #294.
2024-08-14 15:21:30 +02:00
Justus Winter
20eb29930f
Remove the dot output.
- The dot output does not fit into the output framework: it can only
    describe graphs, and most of what sq emits are not graphs.  Once
    sq gains machine-readable output, the current functionality can be
    implemented by emitting the graph data as machine-readable data,
    then transforming it into dot.

  - Fixes #290.

  - Fixes #137.
2024-08-14 14:29:04 +02:00
Neal H. Walfield
916c110626
Port sq key import / export test to the common test framework.
- Port the `sq key import` / `sq key export` test to the common
    test framework.
2024-08-14 13:58:15 +02:00
Neal H. Walfield
8849a8c627
Always summarize sq's result when running it from the test suite.
- When running `sq`, summarize the result even if we don't
    explicitly expect it to succeed or fail.
2024-08-14 13:57:52 +02:00
Justus Winter
75e8339bbe
Implement sq key userid add --name and --email.
- A user ID is an OpenPGP concept.  Most people think in terms of
    names and email addresses.

  - Add and promote --name and --email arguments for sq key userid
    add.

  - Fixes #291.
2024-08-14 11:22:07 +02:00
Justus Winter
099de6d868
Implement sq key generate --name and --email.
- A user ID is an OpenPGP concept.  Most people think in terms of
    names and email addresses.

  - Add and promote --name and --email arguments for sq key generate.

  - See #291.
2024-08-14 11:18:50 +02:00
Justus Winter
658596b0ac
Port test to the common test framework. 2024-08-14 11:18:50 +02:00
Neal H. Walfield
38221a3d7d
tests: Dry out the test framework.
- Replace uses of `sq_key_generate` with `Sq::key_generate`, and
    remove `sq_key_generate`.
2024-08-13 10:08:04 +02:00
Neal H. Walfield
a92ab98f4f
New subcommand sq key subkey password.
- Add a new subcommand, `sq key subkey password`, which changes the
    password protecting the secret key material of a primary key or a
    subkey.

  - Fixes #106.
2024-08-13 10:08:04 +02:00
Justus Winter
49b7f25cc4
Rename key attest-certifications to key approvals update.
- Fixes #295.
2024-08-12 16:21:00 +02:00
Neal H. Walfield
1f0a500fe8
Refactor the sq key password test.
- Add `Sq::key_password` and `Sq::sign` based on the code in the
    `sq key password` test.

  - Implement the `sq key password` test in terms of those functions.
2024-07-18 23:14:08 +02:00
Neal H. Walfield
b8591c480f
Fix the autocrypt test's time.
- When running the autocrypt test, don't use the current time, but
    set it to a fixed time.  This prevents failures due to an expired
    certificate.
2024-07-18 23:14:05 +02:00
Neal H. Walfield
9b991045ca
New subcommand sq key subkey delete to delete secret key material. 2024-07-05 09:50:37 +02:00
Neal H. Walfield
68e5213478
Add tests for sq key delete. 2024-07-05 09:50:37 +02:00
Neal H. Walfield
e85661e8b7
Update code using deprecated functions from sequoia-openpgp.
- Now that we've raised our minimum supported `sequoia-openpgp`
    version, update code using deprecated functions.
2024-07-04 22:51:46 +02:00
Justus Winter
846d819368
Port sq verify's examples to the example framework.
- Port `sq verify`'s examples to the example framework and improve
    them.

  - See #196.
2024-06-20 18:00:47 +02:00
Justus Winter
e78bcf248f
Port sq autocrypt's examples to the example framework.
- Port `sq autocrypt`'s examples to the example framework.

  - See #196.
2024-06-20 15:48:43 +02:00
Justus Winter
815fd5df3b
tests: Port the autocrypt test to the common test framework. 2024-06-20 13:57:44 +02:00
Neal H. Walfield
ae392296f5
Add a top-level --password-file argument to seed the password cache.
- `sq key password`, and `sq sign --symmetric` have local arguments
    to seed the password cache.

  - Many commands could benefit from similar functionality.

  - Add a new top-level argument, `--password-file`, to seed the
    password cache.
2024-06-13 11:39:09 +02:00
Neal H. Walfield
2ed7435b63
Rename sq key password's --clear argument to --clear-password.
- This makes the argument's intent clearer and more closely mirrors
    the other arguments, like `--new-password-file`.
2024-06-13 10:56:10 +02:00
Neal H. Walfield
20d7b8ff68
Add examples for sq key subkey adopt. 2024-06-13 10:47:00 +02:00
Neal H. Walfield
d42da17949
Port sq key password's examples to the example framework.
- Port `sq key password`'s examples to the example framework and
    improve the examples.

  - See #196.
2024-06-13 10:25:00 +02:00
Neal H. Walfield
0e5c58ef05
Use the null policy when creating revocation certificates.
- When creating a revocation certificate using, e.g., `sq key
    revoke`, use the null policy.

  - Even if a certificate is not valid according to the standard
    policy, it can still be useful to revoke it.

  - Fixes #250.
2024-06-12 18:02:22 +02:00
Neal H. Walfield
fa835e234f
Port the sq key revoke tests to the common test framework.
- Add `Sq::key_revoke`, and change the `sq key revoke` integration
    tests to use it.
2024-06-12 16:50:56 +02:00
Neal H. Walfield
1817c305ae
Make helper function more generic.
- Change `compare_notations` from taking a slice containing two
    elements to taking a slice taking any number of elements.
2024-06-12 16:49:26 +02:00
Neal H. Walfield
6f452d51c6
Rename UseridRevocationReason to UserIDReasonForRevocation.
- Rename `UseridRevocationReason` to `UserIDReasonForRevocation`,
    which is more consistent with other identifiers.
2024-06-12 16:47:50 +02:00
Neal H. Walfield
bc5c0cf9f1
Rename the --expiry argument to --expiration.
- Rename the `--expiry` argument to `--expiration`, and adjust the
    name of the corresponding fields, and data structures.

  - Expiration and expiry have about the same meaning.  According to
    my research, "expiration" is used in American English whereas
    both are used in British English.

  - This change aligns the usage with RFC 4880's terminology, which
    uses the word "expiration" many times, but never uses "expiry".
2024-06-11 22:51:40 +02:00
Neal H. Walfield
d76e1ae4db
Change sq key attest-certifications to support the key store and cert store.
- Change `sq key attest-certifications` to use the key store and the
    cert store.

  - See #205.
2024-06-10 23:24:33 +02:00
Neal H. Walfield
6dcfb270ad
Make sq key attest-certifications' positional parameter a named parameter.
- In `sq key attest-certifications`, change the certificate file
     parameter from a positional parameter to a named parameter,
     `--cert-file`.
2024-06-10 23:24:33 +02:00
Neal H. Walfield
90bad2927a
Add test for sq key attest-certifications. 2024-06-10 23:24:33 +02:00
Neal H. Walfield
f1a99b10d9
Change sq key adopt to support the cert store.
- Change `sq key adopt` to use the cert store.

  - See #205.
2024-06-10 23:24:33 +02:00
Neal H. Walfield
f3037392f6
Change sq key adopt to support the key store.
- Change `sq key adopt` to use the key store.

  - See #205.
2024-06-10 23:24:32 +02:00
Neal H. Walfield
47e076d890
If secret key material is passed via --keyring, use it.
- If the user supplies a keyring using `--keyring`, and it contains
    the secret key material that we are looking for, use it.
2024-06-10 23:24:32 +02:00
Neal H. Walfield
cb13f883be
Make sq key adopt's positional parameter a named parameter.
- In `sq key adopt`, change the certifier file parameter from a
     positional parameter to a named parameter, `--cert-file`.
2024-06-10 23:24:32 +02:00
Neal H. Walfield
d76d0fcd52
Change the sq key adopt's tests to use the common test framework. 2024-06-10 23:24:19 +02:00
Neal H. Walfield
a82d9908f9
Change sq pki certify to support the cert store and key store.
- Change `sq pki certify` to support the cert store and key store.

  - See #205.
2024-06-10 23:10:44 +02:00
Neal H. Walfield
028983d40f
Change the sq pki certify tests to use the common test framework. 2024-06-10 23:10:23 +02:00
Neal H. Walfield
b55d1f3239
Make sq pki certify's positional parameter a named parameter.
- In `sq pki certify`, change the certifier file parameter from a
     positional parameter to a named parameter, `--certifier-file`.
2024-06-05 12:33:07 +02:00
Neal H. Walfield
6eef5e9ffc
Change sq key password to support the cert store and key store.
- Change `sq key password` to support the cert store and key store.

  - See #205.
2024-06-05 09:35:11 +02:00
Neal H. Walfield
4a97011452
Add a test for sq key password.
- Add a test for `sq key password`.
2024-06-05 09:32:30 +02:00
Neal H. Walfield
1a33500c26
Change sq key expire etc. to support the cert store and key store.
- Change `sq key expire` and `sq key subkey expire` to support the
    cert store and key store.

  - See #205.
2024-06-05 00:13:50 +02:00
Neal H. Walfield
bb3215adfe
Move subkey functionality from sq key expire into its own command.
- Split the subkey functionality out of `sq key expire` into its own
    command, `sq key subkey expire`.
2024-06-05 00:06:24 +02:00
Neal H. Walfield
52d88e615e
Add a test for sq key expire. 2024-06-05 00:04:31 +02:00
Neal H. Walfield
7866b2f5bb
Change sq key subkey add to support the cert store and key store.
- See #205.
2024-05-29 16:03:06 +02:00
Neal H. Walfield
fb16a29f00
Make sq key subkey add's positional parameter a named parameter.
- In `sq key subkey add`, change the certificate file parameter from a
    positional parameter to a named parameter, `--cert-file`.
2024-05-29 14:00:30 +02:00
Neal H. Walfield
3debf8b584
Modify the sq key revoke tests to test the cert store integration.
- Modify the `sq key revoke` tests to also test the cert store and
    key store integration.

  - Somehow this wasn't added to
    cca564356c.
2024-05-28 15:04:48 +02:00
Neal H. Walfield
ab0e2a446c
Change sq cert lint to support the cert store and key store.
- See #205.
2024-05-28 14:33:27 +02:00
Neal H. Walfield
5c1cf92f9b
Make sq cert lint's position parameter a named parameter.
- In `sq cert lint`, change the certificate file parameter from a
    position parameter to a named parameter, `--cert-file`.
2024-05-28 14:24:58 +02:00
Neal H. Walfield
5f8ef02cd4
Require specifying --userid with sq key userid revoke.
- Change the user ID argument from a position argument in `sq key
    userid revoke` to an argument specified with `--userid`.
2024-05-27 19:14:52 +02:00
Neal H. Walfield
cca564356c
Change sq key revoke etc. to support the cert store and key store.
- Change `sq key revoke`, `sq key subkey revoke`, and `sq key userid
    revoke` to support the cert store and key store.

  - Add `--cert` to specify a certificate by key ID or fingerprint.

  - If `--output` is not specified and `--cert` is, import the
    modified certificate into the cert store.  If `--output` is not
    specified and `--cert-file` is, write the modified certificate to
    stdout.
2024-05-27 19:14:47 +02:00
Neal H. Walfield
e24c9ff92e
Rename --certificate-file and --revocation-file.
- `sq key revoked`, `sq key userid revoke`, and `sq key subkey
    revoke` have two arguments for naming a certificate:
    `--certificate-file` and `--cert-file`.  The latter is an alias.
    Drop `--certificate-file` and promote `--cert-file`.  This
    harmonizes these subcommands with other subcommands, which only
    use `--cert-file`.

  - Rename `--revocation-file` to `--revoker-file`, as the file
    contains a "revoker" not a "revocation."
2024-05-27 19:12:46 +02:00
Neal H. Walfield
42126b5534
Convert sq decrypt examples to use the example framework.
- See #196.
2024-05-27 13:36:35 +02:00
Neal H. Walfield
006482b352
Implement sq key export. 2024-05-21 21:22:44 +02:00
Daiki Ueno
9483554e61
Replace "sq link" mentions with "sq pki link"
- While the commit b5a7d15710 moved the
   "sq link" command under "sq pki", there are some left-overs in the
   error messages.

Signed-off-by: Daiki Ueno <dueno@redhat.com>
2024-04-19 17:22:04 +02:00
Neal H. Walfield
a8f01ef1ae
Make the output of sq pki list, etc. more concise by default.
- The output of `sq pki list`, `sq pki authenticate`, `sq pki
    identify` and `sq pki lookup` are overwhelming.

  - Change the output to only show whether a binding can be
    authenticated, not the paths; group the user IDs according
    to the certificate; and, show whether the components are expired
    or revoked.

  - Use the old output format if the user passes `--show-paths`.

  - Fixes #240.
2024-04-12 18:55:34 +02:00
Neal H. Walfield
a549cabf8d
Require canonical user IDs by default.
- Change `sq key generate` and `sq key userid add` to require
    canonical user IDs by default.

  - If a user ID is not in canonical form, explain the problem, and
    suggest a solution, if possible.

  - Allow the user to disable this check by passing the
    `--allow-non-canonical-userids` flag.

  - Fixes #209.
2024-04-09 12:07:42 +02:00
Neal H. Walfield
0cd8bae06f
Don't generate user ID-less certificates by default.
- Although Sequoia is able to use user ID-less certificates, they
    don't have good support in the ecosystem, and are probably not
    what most users want.

  - Consequently, don't make user ID-less certificates the default.
    Instead, require users to opt in by passing the `--no-userids` flag
    to `sq key generate`.

  - Fixes #223.
2024-04-05 18:08:45 +02:00
Neal H. Walfield
24b383275a
Port sq inspect's examples to the example framework.
- #190.
2024-03-13 10:26:32 +01:00
Neal H. Walfield
039aa33153
When using ioctl's, be as general as possible.
- On some platforms, the arguments are u32s on others they are u64s,
    use `into` to cover more situations.

  - Fixes #211.
2024-03-13 09:34:05 +01:00
Neal H. Walfield
27093c1709
Add support for using a key store.
- Support using keys managed by `sequoia-keystore`.

  - When decrypting a message, have `sq` automatically ask the
    key store to decrypt the PKESKs.

  - Extend `sq sign` and `sq encrypt` with the `--signer-key`
    parameter to use a key managed by the keystore.

  - Add two top-level options: `--no-key-store`, which disables the
    use of the key store, and `--key-store`, which uses an alternate
    key store instance.

  - Add `sq key list` to list keys on the key store.
2024-02-18 15:24:02 +01:00
Justus Winter
2e07bbe6d1
Make sq cert export do what I mean.
- Add --all to export all certificates.

  - Add a query argument that can be a subkey fingerprint or key ID,
    an email address, or a user ID fragment.

  - Fixes #181.
2024-02-14 17:12:42 +01:00
Justus Winter
869b7acec8
Move sq keyring lint to sq cert lint.
- It lints certs, so it should go to sq cert.

  - See #192.
2024-02-09 18:52:11 +01:00
Neal H. Walfield
0d1da78356
Add a framework to format and test examples.
- The `--help` output for most subcommands includes one or more
    examples.

  - We should test these, like we test everything else.

  - Add a framework to format, and test the examples.

  - Fixes #190.

  - Also, fix some broken examples.
2024-02-09 18:08:09 +01:00
Justus Winter
825f4463de
Wrap human-readable pki output. 2024-02-08 16:23:19 +01:00
Justus Winter
2c319b6acb
Don't leak passwords into the process table.
- Remove the offending argument.  Without it, the linter will ask
    for passwords on the tty, aligning it with the rest of sq.
    Programmatic input of passwords is an open question, see #140.

  - Fixes #168.
2024-02-08 12:36:04 +01:00
Justus Winter
4916eb589a
Avoid deprecated functionality. 2024-01-29 19:48:51 +01:00
Justus Winter
2bae7c8c30
Turn Autocrypt Gossip into PKI artifacts when importing. 2024-01-29 19:48:51 +01:00
Justus Winter
5e2c6da79c
Add sq toolbox, move the armor and packet subcommands there. 2024-01-19 11:54:48 +01:00
Justus Winter
b7ef68ca35
Move sq import and export to sq cert. 2024-01-19 11:24:21 +01:00
Justus Winter
b5a7d15710
Move sq link to sq pki. 2024-01-17 14:40:55 +01:00
Justus Winter
46af430766
Move sq certify to sq pki. 2024-01-17 14:40:55 +01:00
Justus Winter
b000993817
Move all global PKI options to subcommands where they are needed. 2024-01-17 14:40:55 +01:00
Justus Winter
ed4f1efcb5
Rename sq wot to sq pki. 2024-01-16 16:22:30 +01:00
Justus Winter
49dd753bab
Harmonize specifying the trust amount.
- See #109.
2024-01-12 18:33:56 +01:00
Justus Winter
c4a2c5666f
tests: Detach console for child processes.
- Otherwise, rpassword will ask for passwords and hang the tests.
2024-01-08 14:18:42 +01:00
Justus Winter
70eb478987
Dump certs if we see a bad signature in the sq-certify tests.
- See #9.
2024-01-04 15:01:19 +01:00
Justus Winter
dc24306af1
Emit partial TPKs as revocation certificates.
- When emitting revocation certificates, emit the revocation
    signature with enough context so that it is a well-formed TPK,
    i.e. include the primary key, the component to be revoked (if
    revoking a user ID or subkey), and the revocation signature.

  - Having a partial TPK instead of a bare revocation makes handling
    it much easier, as it can be stored and transported like any
    cert.  It also gives the recipient of the certificate more
    context, and simplifies merging it into a database of certs.

  - Previously, there was a bug in sq where we would emit secret key
    material when emitting revocation certificates.  The reason for
    that was that the certificate was first converted to a packet
    stream, and then each packet serialized.  In contrast, if a
    Cert is serialized, no secrets are emitted unless the
    programmer opts in.  In a way, this is the more comprehensive fix
    for the problem, as it leverages sequoia-openpgp's mechanisms to
    protect secret key material.

  - See #160.
2023-12-11 15:48:06 +01:00
Justus Winter
8216857de2
Strip secret key material from emitted revocation certificates.
- When doing a userid, subkey, or third-party certificate
    revocation, with the cert given to --certificate-file containing
    secret key material, we previously emitted a revocation
    certificate containing secret key material.

  - This patch changes that in a straight-forward way that is easy to
    backport to prior versions.  A more comprehensive fix will follow.

  - Fixes #160.
2023-12-11 15:40:31 +01:00
Justus Winter
4ed3d371e5
Replace once_cell with types from the standard library. 2023-12-06 17:42:48 +01:00
Justus Winter
f6b936d889
Fix warning. 2023-11-30 14:42:12 +01:00
Justus Winter
b8f9670497
Improve pluralization: make it convenient and prevent word-wrapping. 2023-11-30 14:42:11 +01:00
Justus Winter
2ab3bd5efd
Word-wrap lines in human-readable messages.
- Replace every eprintln by wprintln, which prints to stderr as
    well, but word-wraps the messages.
2023-11-29 16:41:40 +01:00