SQ(1)

๐ŸŒธ NAME ๐ŸŒธ

okay bestie, meet sq(1) โ€” from the User Commands section, it's a command-line frontend for Sequoia, which is an implementation of OpenPGP. Basically the CLI bestie for Sequoia energy. ๐Ÿ’–

โœจ SYNOPSIS โœจ

Here's the whole command shape, and yes we're keeping every line:

sq encrypt [OPTIONS] FILE
sq decrypt [OPTIONS] FILE
sq sign [OPTIONS] FILE
sq verify [OPTIONS] FILE
sq download [OPTIONS]
sq inspect [OPTIONS] FILE
sq cert [OPTIONS]  SUBCOMMAND
sq key [OPTIONS]  SUBCOMMAND
sq pki [OPTIONS]  SUBCOMMAND
sq network [OPTIONS]  SUBCOMMAND
sq keyring [OPTIONS]  SUBCOMMAND
sq packet [OPTIONS]  SUBCOMMAND
sq config [OPTIONS]  SUBCOMMAND
sq toc [OPTIONS]
sq version [OPTIONS]

๐Ÿ’ซ DESCRIPTION ๐Ÿ’ซ

Okay so functionality is grouped and available using subcommands. This interface is not completely stateless โ€” in particular, the user's default certificate store is used. You can disable that with --cert-store=none. Similarly, a key store is used to manage and protect secret key material, and you can disable that with --key-store=none. ๐Ÿซถ

OpenPGP data can be provided in binary or ASCII armored form, and it's handled automatically. Emitted OpenPGP data is ASCII armored by default. โœจ

Terminology check, iykyk: "certificate", or "cert" for short, means OpenPGP keys that do not contain secrets. Conversely, "key" means OpenPGP keys that do contain secrets. Periodt. ๐Ÿ‘‘

๐ŸŽ€ OPTIONS ๐ŸŽ€

๐ŸŒ Global options ๐ŸŒ

  • --batch โ€” Prevents any kind of prompting. It enables batch mode. In batch mode, sq will never ask for user input, such as prompting for passwords. ๐Ÿ’…
  • --cert-store=PATH โ€” Specify the location of the certificate store. By default, sq uses the OpenPGP certificate directory in Sequoia's home directory (see --home), $HOME/.local/share/pgp.cert.d. This can be overridden by setting the PGP_CERT_D environment variable. Use 'default' to explicitly use the default cert store, use 'none' to not use a cert store. ๐ŸŽ€
  • --cli-version=CLI_VERSION โ€” Select a CLI version. sq's CLI is versioned using a semantic versioning scheme. Setting this option causes sq to error out if it does not implement an interface that is compatible with the specified version. For instance, if you set this to 1.1.0 and sq only implements version 1.0.0 of the interface, then sq will error out. ๐Ÿ˜ค

sq may implement multiple interfaces (e.g., 1.1.4, and 2.0.5). By default, it selects the newest version. As such, if you require a particular interface, you need to set this option for every call to sq. ๐Ÿ”

bestie, this option must be the first option on the command line. no cap.

This version of sq implements version 1.5.0 of the CLI interface. Stable since 1.2.0. โญ

  • -h, --help โ€” Print help (see a summary with '-h'). So --help gives you the full help, and -h is the summary vibe. ๐Ÿ™ˆ
  • --home=PATH โ€” Set the home directory. Sequoia's default home directory is $HOME. When using the default location, files are placed according to the local standard, e.g., the XDG Base Directory Specification. When an alternate location is specified, the user data, configuration files, and cache data are placed under a single, unified directory. This is a lightweight way to partially isolate sq. Use 'default' to explicitly use the default location, use 'none' to not use a home directory. ๐Ÿ 
  • --key-store=PATH โ€” Override the key store server and its data. A key store server manages and protects secret key material. By default, sq connects to the key store server for Sequoia's default home directory (see --home), $HOME/.local/share/sequoia/keystore. If no key store server is running, one is started. ๐Ÿ”

This option causes sq to use an alternate key store server. If necessary, a key store server is started, and configured to look for its data in the specified location. Use 'default' to explicitly use the default server, use 'none' to not use a key store. ๐Ÿ’œ

  • --keyring=PATH โ€” Specify the location of a keyring to use. Keyrings are used in addition to any certificate store. The content of the keyring is not imported into the certificate store. When a certificate is looked up, it is looked up in all keyrings and any certificate store, and the results are merged together. ๐Ÿฆ‹
  • --known-notation=NOTATION โ€” Add NOTATION to the list of known notations. This is used when validating signatures. Signatures that have unknown notations with the critical bit set are considered invalid. โš ๏ธ
  • --overwrite โ€” Overwrite existing files. Simple slay. ๐Ÿ”ฅ
  • --password-file=FILE โ€” Seed the password cache with the specified password. The password is added to the password cache. When decrypting secret key material, the password cache is only used if the key is not protected by a retry counter, which automatically locks the key if a wrong password is entered too many times. ๐Ÿ˜ญ
heads up: the entire key file will be used as the password, including any surrounding whitespace like a trailing newline. bestie, do not forget that newline. ๐Ÿ’€
  • --policy-as-of=TIME โ€” Select the cryptographic policy as of the specified time. The time is expressed as an ISO 8601 formatted timestamp. The policy determines what cryptographic constructs are allowed. ๐Ÿ•ฐ๏ธ

If you are working with a message that sq rejects, because it is protected by cryptographic constructs that are now considered broken, you can use this option to select a different cryptographic policy. If you are relying on the cryptography, e.g., you are verifying a signature, then you should only do this if you are confident that the message hasn't been tampered with. ๐Ÿšจ

this is the "please let me look at old crypto" button; treat it with main-character caution. ๐Ÿ‘‘

TIME is interpreted as an ISO 8601 timestamp. To set the policy time to January 1, 2007 at midnight UTC, you can do:

$ sq --policy-as-of 20070101 verify --message msg.pgp

Defaults to the reference time, which can be set using --time. โœจ

  • -q, --quiet โ€” Be more quiet. The default can be changed in the configuration file using the setting ui.verbosity. ๐Ÿคซ
  • --time=TIME โ€” Set the reference time as an ISO 8601 formatted timestamp. Normally, commands use the current time as the reference time. This argument allows the user to use a different reference time. For instance, when creating a key using sq key generate, the creation time is normally set to the current time, but can be overridden using this option. Similarly, when verifying a message, the message is verified with respect to the current time. This option allows the user to use a different time. โฐ

TIME is interpreted as an ISO 8601 timestamp. To set the certification time to July 21, 2013 at midnight UTC, you can do:

$ sq --time 20130721 verify --message msg.pgp

To include a time, say 5:50 AM, add a T, the time and optionally the timezone (the default timezone is UTC):

$ sq --time 20130721T0550+0200 --message verify msg.pgp
  • --trust-root=FINGERPRINT|KEYID โ€” Consider the specified certificate to be a trust root. Trust roots are used by trust models, e.g., the Web of Trust, to authenticate certificates and User IDs. ๐ŸŒˆ
  • -v, --verbose โ€” Be more verbose. The default can be changed in the configuration file using the setting ui.verbosity. ๐Ÿ—ฃ๏ธ

โœจ SUBCOMMANDS โœจ

Okay so this is where the whole thing opens up like a group chat with fifty tabs โ€” each subcommand has its own main character energy. Bestie, let's go through them in order.

๐Ÿ’– sq encrypt ๐Ÿ’–

sq encrypt encrypts a message. That's the whole gig. You can encrypt for any number of recipients and with any number of passwords, and you can optionally sign the message in the process. The converse operation is sq decrypt.

It respects the reference time set by the top-level --time argument. It uses that reference time when selecting encryption keys, and it sets the signature's creation time to the reference time. Slay.

๐Ÿ”“ sq decrypt ๐Ÿ”“

sq decrypt decrypts a message using either supplied keys, or by prompting for a password. If message tampering is detected, an error is returned โ€” see below for the deets.

If certificates are supplied using the --signer-file option, any signatures that are found are checked using these certificates. Verification is only successful if there is no bad signature, and the number of successfully verified signatures reaches the threshold configured with the --signatures parameter.

If the signature verification fails, or if message tampering is detected, the program terminates with an exit status indicating failure, and the output file is deleted. If the output was sent to stdout, then the last 25 MiB of the message are withheld โ€” consequently, if the message is smaller than 25 MiB, no output is produced. That part is highkey important, no cap.

The converse operation is sq encrypt.

โœ๏ธ sq sign โœ๏ธ

sq sign signs messages or data files. It creates signed messages or detached signatures. Detached signatures are often used to sign software packages.

The converse operation is sq verify.

sq sign respects the reference time set by the top-level --time argument. When set, it uses the specified time instead of the current time when determining what keys are valid, and it sets the signature's creation time to the reference time instead of the current time. Periodt.

๐Ÿ•ต๏ธ sq verify ๐Ÿ•ต๏ธ

sq verify verifies signed messages or detached signatures.

When verifying signed messages, the message is written to stdout or the file given to --output.

When a detached message is verified, no output is produced. Detached signatures are often used to sign software packages.

Verification is only successful if there is no bad signature, and the number of successfully verified signatures reaches the threshold configured with the --signatures parameter. If the verification fails, the program terminates with an exit status indicating failure, and the output file is deleted. If the output was sent to stdout, then the last 25 MiB of the message are withheld โ€” consequently, if the message is smaller than 25 MiB, no output is produced.

A signature is considered to have been authenticated if the signer can be authenticated. If the signer is provided via --signer-file, then the signer is considered authenticated. Otherwise, the signer is looked up and authenticated using the Web of Trust. If at least one User ID can be fully authenticated, then the signature is considered to have been authenticated. If the signature includes a Signer User ID subpacket, then only that User ID is considered. Note: the User ID need not be self signed.

The converse operation is sq sign.

If you are looking for a standalone program to verify clear text signatures, detached signatures or inline signatures, consider using sequoia-sqv.

sq verify respects the reference time set by the top-level --time argument. When set, it verifies the message as of the reference time instead of the current time.

๐ŸŒ sq download ๐ŸŒ

Download and authenticate the data.

This command downloads the data from the specified URL, checks the signature, and then authenticates the signer. If the signer cannot be authenticated, the data is deleted, if possible. The vibe check is strict here, bestie.

๐Ÿ” sq inspect ๐Ÿ”

Inspect data, like file(1).

It is often difficult to tell from cursory inspection using cat(1) or file(1) what kind of OpenPGP one is looking at. This subcommand inspects the data and provides a meaningful human-readable description of it.

sq inspect respects the reference time set by the top-level --time argument. It uses the reference time when determining what binding signatures are active.

๐Ÿ“œ sq cert ๐Ÿ“œ

Manage certificates.

We use the term "certificate", or "cert" for short, to refer to OpenPGP keys that do not contain secrets. This subcommand provides primitives to generate and otherwise manipulate certs.

Conversely, we use the term "key" to refer to OpenPGP keys that do contain secrets. See sq key for operations on keys.

๐Ÿ”‘ sq key ๐Ÿ”‘

Manage keys.

We use the term "key" to refer to OpenPGP keys that do contain secrets. This subcommand provides primitives to generate and otherwise manipulate keys.

Conversely, we use the term "certificate", or "cert" for short, to refer to OpenPGP keys that do not contain secrets. See sq cert for operations on certificates.

๐Ÿซถ sq pki ๐Ÿซถ

Authenticate certs using the Web of Trust.

The "Web of Trust" is a decentralized trust model popularized by PGP. It is a superset of X.509, which is a hierarchical trust model, and is the most popular trust model on the public internet today. As used on the public internet, however, X.509 relies on a handful of global certification authorities (CAs) who often undermine its security.

The Web of Trust is more nuanced than X.509. Using the Web of Trust, require multiple, independent paths to authenticate a binding by only partially trusting CAs. This prevents a single bad actor from compromising their security. And those who have stronger security requirements can use the Web of Trust in a completely decentralized manner where only the individuals they select โ€“ who are not necessarily institutions โ€“ act as trusted introducers. Literally iconic.

๐ŸŒˆ sq network ๐ŸŒˆ

Retrieve and publish certificates over the network.

OpenPGP certificates can be discovered and updated from, and published on services accessible over the network. This is a collection of commands to interact with these services.

๐ŸŽ€ sq keyring ๐ŸŽ€

Manage collections of keys or certs.

Collections of keys or certificates โ€” also known as "keyrings" when they contain secret key material, and "certrings" when they don't โ€” are any number of concatenated certificates. This subcommand provides tools to list, split, merge, and filter keyrings.

Note: In the documentation of this subcommand, we sometimes use the terms keys and certs interchangeably.

๐Ÿงš sq packet ๐Ÿงš

Low-level packet manipulation.

An OpenPGP data stream consists of packets. These tools allow working with packet streams. They are mostly of interest to developers, but sq packet dump may be helpful to a wider audience both to provide valuable information in bug reports to OpenPGP-related software, and as a learning tool.

โš™๏ธ sq config โš™๏ธ

Query, inspect, and create the configuration file.

This subcommand can be used to query and inspect the configuration file (default location: $HOME/.config/sequoia/sq/config.toml), and to create a template that can be edited to your liking.

Configuration file: $HOME/.config/sequoia/sq/config.toml

๐Ÿ“‹ sq toc ๐Ÿ“‹

Recursively list all commands.

Recursively List all commands and show their short help.

๐Ÿ’ซ sq version ๐Ÿ’ซ

Detailed version and output version information.

With no further options, this command lists the version of sq, the version of the underlying OpenPGP implementation sequoia-openpgp, and which cryptographic library is used.


๐ŸŒธ ENVIRONMENT ๐ŸŒธ

These are the environment variables that can change how sq moves. Lowkey powerful, highkey useful.

๐Ÿฆ‹ SEQUOIA_CERT_STORE=PATH

Specify the location of the certificate store.

By default, sq uses the OpenPGP certificate directory in Sequoia's home directory (see --home), $HOME/.local/share/pgp.cert.d. This can be overridden by setting the PGP_CERT_D environment variable.

Use 'default' to explicitly use the default cert store, use 'none' to not use a cert store.

๐Ÿ  SEQUOIA_HOME=PATH

Set the home directory.

Sequoia's default home directory is $HOME. When using the default location, files are placed according to the local standard, e.g., the XDG Base Directory Specification. When an alternate location is specified, the user data, configuration files, and cache data are placed under a single, unified directory. This is a lightweight way to partially isolate sq.

Use 'default' to explicitly use the default location, use 'none' to not use a home directory.

๐Ÿ—๏ธ SEQUOIA_KEY_STORE=PATH

Override the key store server and its data.

A key store server manages and protects secret key material. By default, sq connects to the key store server for Sequoia's default home directory (see --home), $HOME/.local/share/sequoia/keystore. If no key store server is running, one is started.

This option causes sq to use an alternate key store server. If necessary, a key store server is started, and configured to look for its data in the specified location.

Use 'default' to explicitly use the default server, use 'none' to not use a key store.

โœจ EXAMPLES โœจ

okay bestie, this is the part where it all clicks โ€” real commands, real vibes, zero guesswork ๐Ÿ’–

๐Ÿงš sq encrypt

Encrypt a file for a recipient when you've got their fingerprint. iconic.

sq encrypt --for=EB28F26E2739A4870ECC47726F0073F60FD0CBF0 \
       --signer-email=juliet@example.org document.txt

Encrypt a file for a recipient when you've got their email instead. no cap.

sq encrypt --for-email=alice@example.org \
       --signer-email=juliet@example.org document.txt

๐Ÿ”“ sq decrypt

Decrypt a file using a secret key. yes bestie, the secret key is doing the heavy lifting.

sq decrypt --recipient-file juliet-secret.pgp ciphertext.pgp

Decrypt a file and verify signatures while you're at it. multitasking queen behavior.

sq decrypt --recipient-file juliet-secret.pgp --signer-file \
       romeo.pgp ciphertext.pgp

Decrypt a file using the key store. lowkey the easiest route.

sq decrypt ciphertext.pgp

โœ๏ธ sq sign

Create a signed message. main character energy only.

sq sign --signer-file juliet-secret.pgp --message document.txt

Create a detached signature. it's giving separate-but-attached ๐Ÿ’…

sq sign --signer-file juliet-secret.pgp \
       --signature-file=document.txt.sig document.txt

๐Ÿ” sq verify

Verify a signed message. trust issues? valid.

sq verify --message document.pgp

Verify a detached signature. yup, still slaying.

sq verify --signature-file=document.sig document.txt

Verify a message as of June 19, 2024 at midnight UTC. time travel but make it cryptographic โณ

sq verify --time 2024-06-19 --message document.pgp

โฌ‡๏ธ sq download

Download and verify the Debian 12 checksum file. Debian girlies rise up ๐Ÿ“

sq download --url=file://debian/SHA512SUMS \
       --signature-url=file://debian/SHA512SUMS.sign \
       --signer=DF9B9C49EAA9298432589D76DA87E80D6294BE9B \
       --output=SHA512SUMS

๐Ÿ•ต๏ธ sq inspect

Inspect a certificate. look at her ๐Ÿ‘‘

sq inspect juliet.pgp

Show how the certificate looked on July 21, 2013. vintage era, honestly.

sq inspect --time 20130721 juliet.pgp

Inspect an encrypted message. peek behind the curtain.

sq inspect message.pgp

Inspect a detached signature. small but mighty.

sq inspect document.sig

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

bestie, go read these next โ€” the whole squad is here:

For the full documentation see <https://book.sequoia-pgp.org/>. iykyk ๐Ÿ’–


๐ŸŒˆ VERSION ๐ŸŒˆ

1.5.0


that's the whole SQ(1) page, bestie โ€” brought to you by Sequoia PGP, version 1.5.0, page SQ(1) ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from
  • fedora 43: sequoia-sq 1.5.0-1.fc43 ยท LGPL-2.0-or-later AND Apache-2.0 AND BSL-1.0 AND BSD-3-Clause AND MIT AND MPL-2.0 AND Unicode-3.0 AND Unicode-DFS-2016 AND Zlib AND bzip2-1.0.6 AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT)
  • fedora 44: sequoia-sq 1.5.0-1.fc44 ยท LGPL-2.0-or-later AND Apache-2.0 AND BSL-1.0 AND BSD-3-Clause AND MIT AND MPL-2.0 AND Unicode-3.0 AND Unicode-DFS-2016 AND Zlib AND bzip2-1.0.6 AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT)
  • opensuse-leap 16.0: sequoia-sq 1.5.0-bp160.1.1 ยท LGPL-2.0-or-later
  • opensuse-leap 16.0: sequoia-sq 1.5.0-bp160.1.1 ยท LGPL-2.0-or-later
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms