Expand description
OpenPGP (RFC 9580) for mail, with Sequoia and its pure-Rust cryptography.
- Your keys live in
~/.local/share/sioul/pgp/own/. A key made here keeps its revocation certificate beside it,<fingerprint>.rev, yours alone as the key is (revocation_path); revoking is not built. A key’s private part is in one of two places (Place): here, encrypted with a passphrase the system keyring keeps (sioul-syncasks it), so nothing is asked at each message; or on a security key, which signs and opens itself after its PIN (crate::securitykey), Sioul keeping only its public certificate. Keys come from an import (a file, GnuPG’s export), are made here, or are a security key’s. - Others’ keys live in
…/pgp/others/: imported, found in their messages (Autocrypt), or looked up on request. - Signing and opening take Sequoia’s own
SignerandDecryptortraits: a key here or a security key, the same way. A message a security key opened keeps its session key in memory (SessionKeys), so that it opens again without the key until Sioul closes. - What this module does not do: talk to the network, or to the keyring. Passphrases and PINs come in as arguments.
Structs§
- Checked
- A signature, checked.
- Helper 🔒
- KeySummary
- A key as the window lists it.
- Keys
- The keys Sioul knows: yours (their secret parts here, or on a security key), others’, and your security keys.
- Lent 🔒
- A signer lent for one message: Sequoia’s stream takes its signer by value, and a security key’s signer borrows what it needs to reach the key.
- Opened
- What opening a message found.
- Own
- Your key for an address: its certificate, and where its private part is.
- PgpView
- What a protected message showed when opened, for the reader’s line.
- Served 🔒
- What travels beside each of others’ keys (
others/<fingerprint>.toml): the addresses it was learned for (an Autocrypt header’s, a lookup’s) or, imported from a file you chose, every address bound to it. The only ones it serves (review of 19 October 2026, N2). - Session
Keys - The session keys of messages a security key opened, by message: such a message opens again, with its attachments and its answer, without the key, until Sioul closes. In memory only, never on disk.
- Unlock
- How your keys open what is encrypted to you.
Enums§
- Fingerprint
- A key’s fingerprint, as the crates that do not use Sequoia themselves name it. A long identifier for certificates and keys.
- Place
- Where the private part of one of your keys is.
Constants§
- LARGEST_
DECRYPTED 🔒 - The most a decrypted message may hold: anyone can encrypt to your key, and a few kilobytes of compressed data can inflate to gigabytes.
- OTHERS_
FORMAT 🔒 - The format of
others/: 2 since its keys say what they serve; 1 (none said), what Sioul kept before, or what an older Sioul writes through the sharing.
Functions§
- armored_
keys 🔒 - The armored key blocks of
text, in order: each from its “—–BEGIN PGP PUBLIC KEY BLOCK—–” (or PRIVATE) to the end of its “—–END PGP” line. What lies around or between them is left out, a message’s or a signature’s block among it. - autocrypt_
header - The Autocrypt header for your outgoing mail: your key, smallest form (primary, encryption subkey, the user ID with your address).
- autocrypt_
key - Autocrypt (Level 1, §2.1): the key a message’s header carries for its sender.
- bound 🔒
- Whether a key holds
addressamong its user IDs bound to it, as Sequoia’s policy sees them: a user ID with no binding signature of the key’s own, revoked, or bound under an algorithm the policy refuses, names nothing (review of 19 October 2026, F1:userids()alone counts every user ID, “even those without a binding signature”). - bound_
addresses 🔒 - The addresses bound to
cert(bound), as written there, each once. - can_
sign_ 🔒with - Whether the key
fingerprintofcertcan sign now: valid, alive, not revoked, allowed to sign. - canonical 🔒
- Lone LF become CRLF: what was signed is the canonical form (RFC 3156 §5).
- certificates_
in - The certificates of
bytes(armored or binary), read, not kept. - certificates_
of - The certificates among
bytes(armored or binary, one or several), as a certificate from outside is read everywhere here (a file, GnuPG, a server, a message): read as they came, and again with their signatures’ numbers written shortest (minimal_mpis), merged by fingerprint, in the order they came; so the repair only ever adds, never takes a certificate or a part away. Sequoia’s words when neither reading reads. - decrypt
- Decrypts an OpenPGP message (armored or not) with your keys, checking the
signatures inside.
unlockgives the passphrase of a key of yours here, the session keys kept, and your security key when you asked to use it. - email_
is 🔒 - embedded_
shortened 🔒 - A signature’s unhashed area (RFC 9580, 5.2.3.7) with each embedded
signature (subpacket 32) shortened, its own unhashed area left as it came
(
shortened_at), its length said again; none when none needed it, or when the area does not read as subpackets. - encrypt
dataencrypted to the recipients’ keys, signed by yours when given; armored.- encrypt_
for_ 🔒yourself dataencrypted for you alone, toyours: an encryption key of yours that expired but was not revoked still takes it, since you open it with that key, which Sequoia’s policy allows (review of 19 October 2026, F19).- encrypt_
to 🔒 - export_
public - A key’s public part, armored, to give to others.
- for_
its_ 🔒address certwith only its user IDs foraddress, when one of them is bound to it (names); none otherwise. What a certificate brings from elsewhere (an Autocrypt header, a lookup) is kept for the address it came for alone: its other user IDs, bound or not, never make it another address’s key (review of 19 October 2026, F2).- generate
- Makes a key for you: Curve25519, for signing and encrypting, valid three
years; its secret parts encrypted with
passphrase. Its revocation certificate, which Sequoia makes with it, is kept beside it (revocation_path): the only way to revoke the key once it is lost. - generate_
at 🔒 generateinto the folderroot(pgp/).- header_
end 🔒 - Where a message’s header ends: after its first empty line.
- here_
signer - Your key here that signs, its secret part opened with
passphrase: the signer of a key kept on this device. - import
- Imports the keys of a file: armored or binary, public or secret. Someone’s key imported so serves every address bound to it: you chose the file.
- import_
at 🔒 importinto the folderroot(pgp/).- is_
encrypted - Whether a message is encrypted with OpenPGP, as a whole: PGP/MIME (RFC
3156, the shape
seal_messagewrites), or an inline message whose whole first text part is one armored message. Never a text that quotes one among its words (review of 19 October 2026, F7: a decrypted copy quoting an older armored block was taken for sealed). Nothing is opened. - judged 🔒
- What a key kept without that file serves (before 19 October 2026, or written through the sharing by an older Sioul), judged as it is: the address of every user ID it carries, bound or not, revoked or not, since a Sioul before 1f9acc0 took a key on any of them (a header’s key had to name its sender in some user ID, bound by nothing if it liked). Its one address, only when every user ID names that same address and it is bound; else none (review of 19 October 2026, N2 and R1: Mallory’s key binding Jane’s address, his own carried by nothing, came from his header and named one bound address, hers). A key it serves none waits, kept, until it comes again for an address.
- keep_
card_ certificate - Keeps the certificate of your security key with your keys: public parts only.
- keep_
others_ for_ their_ addresses - Once on each device (
state/pgp-others.toml): each key ofothers/kept without what it serves (format 1) gets it, as it is judged now (judged): its one address when every user ID it carries names it and it is bound, else none; written as judged, not learned. Kept so, an older Sioul’s later write to it (every user ID of a header, merged) adds no address it serves. The key’s own file is never touched: one that serves none stays, to serve again once it comes for an address (its owner’s next message, a lookup). How many keys it wrote it for. - keep_
others_ 🔒for_ their_ addresses_ at keep_others_for_their_addressesin the folderroot(pgp/), its mark atmark.- key_of
- The key
fingerprintofcert, its public part, primary or subkey. - kind_of 🔒
- learn
- Keeps keys found for
address: public parts only, and only those naming it. - learn_
at 🔒 learninto the folderroot(pgp/).- learn_
autocrypt - Keeps a key from an Autocrypt header: only public parts, only for its sender’s address, never one of yours (whoever sends your own key back cannot add anything to it).
- learn_
autocrypt_ 🔒at learn_autocryptinto the folderroot(pgp/).- looks_
opened - Whether
rawhas the head of a messageopenrebuilt (opened_split): what may be a copy decrypted by Sioul before 19 October 2026. - message_
id 🔒 - A message’s name among the session keys: SHA-256 of its encrypted bytes.
- mime_
split 🔒 - Where the
MIME-Version: 1.0lineopenadds after a message’s outer headers starts, when nothing of MIME comes before it; withcontent, only when a content’s header follows it (whatopenrebuilt from an entity with headers of its own). Without, whatever follows: an entity with an empty head, or none, rebuilt so (review of 19 October 2026, N7). - minimal_
mpis bytes(armored or binary) with the numbers of each signature written in their shortest form, as RFC 9580 (3.2) asks and Sequoia insists (certificates_ofreads with it). GnuPG 2.4.4, Ubuntu 24.04’s, writes about one key signature in 128 with a number one octet too long (a leading zero octet counted in its length); Sequoia then read that signature as none, and the subkey it binds, or the whole key, as missing. A signature’s numbers are not part of what it signs: written shorter they are the same numbers, and Sequoia still checks the signature. Only ever shorter: a length said too short is left as it came. Armor is read block by block, every key block kept, in order. The bytes as they came when none needed it, or when they do not read as packets of known length; armored bytes come back binary once changed, which every reader here takes.- names 🔒
- Whether a key serves
address: bound to it (bound) and not revoked as a whole (usable). Every choice of a key for an address goes through it (for_address,self_cert_for,own_for). - names_
address - For the window’s words: whether
certholdsaddressamong the user IDs bound to it, revoked as a whole or not. - new_
passphrase - A long random passphrase for a key made here: nobody types it, the keyring keeps it.
- only_
bound_ 🔒subkeys certwithout the subkeys its own primary key does not bind under the policy (bound by nothing, or by another key): what a lookup brings of yours adds only what your key signed (review of 19 October 2026, Info: such subkeys were inert, but kept, and a security key’s travelled in its shared file).- only_
for 🔒 certcut to the user IDs ofaddresses.- open
- Opens a protected message: PGP/MIME encrypted or signed (RFC 3156), or
inline PGP. Gives back the message as it reads once decrypted (its own
headers, then what was inside), when it was encrypted, and what was found;
None when nothing is protected. A message encrypted to your security key
opens only when
unlockcarries it, or from a session key kept; otherwise its view names the key it waits for. - opened_
split 🔒 - The head of a message as
openrebuilds an encrypted one: its outer header lines (none of themContent-norMIME-Version), the lineMIME-Version: 1.0it adds after them, then the opened entity’s own header lines, aContent-one among them. Where that line is, when the head has that shape: what a copy decrypted by Sioul before 19 October 2026 looks like (a message that came in clear may too). - opens
- Whether
passphraseopens the secret parts of your keyfingerprint. - outer_
headers 🔒 - The message’s own header lines but its MIME ones, which the decrypted body brings.
- own_dir 🔒
- packet_
at 🔒 - The packet at
at(RFC 9580, 4.2): its tag and where its body lies; none for one cut short, or of partial length. - pgp_dir 🔒
- policy 🔒
- put_
packet 🔒 - A packet in OpenPGP’s format: its tag, its length, its body.
- put_
subpacket_ 🔒length - A subpacket’s length (RFC 9580, 5.2.3.7), in one, two or five octets.
- read_
certs 🔒 - read_
others 🔒 - Others’ keys in
dir, each cut to the addresses it serves (served_by); one that serves none is left out of every use, its signatures said as a key’s Sioul does not know (kept on the disk, it comes back once learned again for an address). - recipients_
of - The keys a message is encrypted to, as its packets name them (key IDs or fingerprints, hexadecimal), in its order: whom it is for, nothing opened.
- record_
of 🔒 - What the file beside someone’s key
cert, kept indir, says, when it reads. - remove
- Removes a key; yours are kept aside in
pgp/removed, never deleted, with their revocation certificate. - remove_
in 🔒 removein the folderroot(pgp/).- revocation_
path - Where the revocation certificate of your key made here is kept: beside
the key,
pgp/own/<fingerprint>.rev, readable by you alone (write_key), as GnuPG keeps its own inopenpgp-revocs.d. - revocation_
text 🔒 - A revocation certificate as a file to keep: what it is, in a few lines, then the signature armored, a colon before its first line so that it cannot be imported by mistake (as GnuPG writes its own).
- revoked_
whole - Whether
certis valid but revoked as a whole, for the window’s words. - save_
revocation - Copies the revocation certificate of your key
fingerprintintofolder, as<fingerprint>.rev(a number added when that name is taken), yours alone; none kept for that key, an error. - save_
revocation_ 🔒at save_revocationfrom the folderroot(pgp/).- seal_
message - A message as it reads (opened, in clear), sealed again for
to, as an encrypted message comes (PGP/MIME, RFC 3156): its own headers in clear but those of its content (From, To, Date, Subject, Message-ID: what a list of mail shows), its content and their headers encrypted inside.opengives the same message back. For the copy kept beside a draft that answers an encrypted message, never left in clear. - served_
by 🔒 - The addresses someone’s key
cert, kept indir, serves: those its file beside says, as they are bound to it; without that file, as it is judged (judged), at each reading. - served_
path 🔒 - shortened 🔒
- The packets of
binarywith each version 4 signature’s numbers in their shortest form; none when none needed it, or whenbinarydoes not read as packets of known length (a partial length is data’s, never a key’s). - shortened_
at 🔒 signature_shortened, the signatures embedded in the unhashed area looked into only whendescend: one level, never more. An embedded signature’s own embedded ones stay as they came: Sequoia refuses a signature embedded in an embedded one, and each level looked into would take the stack of the thread reading a file from outside (a phone’s import runs on Qt’s own, about 1 MiB), a crafted one nesting thousands.- sign_
detached - A detached signature of
data, armored, and the hash it used (“pgp-sha512”), for multipart/signed (RFC 3156 §5).signeris your key here (here_signer) or on a security key (securitykey::CardSigner). - signature_
shortened 🔒 - A version 4 signature’s body with its numbers in their shortest form (no leading zero bits, RFC 9580, 3.2), and those of a signature embedded in its unhashed area (a signing subkey’s back-signature, where GnuPG writes it); never anything in its hashed area, which the signature covers. None when nothing needed it, when its algorithm’s are not numbers (Ed25519’s own octets) or do not read whole, or when a length is said too short: only ever shorter, as GnuPG’s fault is.
- stand_
in_ key - A key for tests, made now (Curve25519: its primary key certifies and
signs, a subkey decrypts), named
userid, its secret part unencrypted, armored: for the crates that do not use Sequoia themselves. Never one of yours. - store_
at 🔒 - Keeps a key you chose (imported, made here) in the folder
root(pgp/), merged with what was known of it. Secret parts go with yours, and so does a certificate of yours. - store_
from_ 🔒elsewhere_ at - Keeps a key that came from elsewhere for
address(a lookup: its domain’s Web Key Directory, keys.openpgp.org): its user IDs for that address alone. One of yours brought again so is merged without anything it names: only what your own primary key binds (a renewal’s signatures, a subkey), never another source’s user IDs into your certificate (review of 19 October 2026, F1). - store_
in 🔒 - store_
others 🔒 - Keeps someone’s key for
learned: the address it came for (a key from elsewhere comes cut to it,for_its_address) or, imported from a file you chose, every address bound to it. Merged with the one kept, it serves what it served and these (its file beside, written first), cut to their user IDs: an address a key kept before, or an older Sioul’s write, named besides is never kept nor served (review of 19 October 2026, N2), and the user IDs of an address it was learned for before stay. - summaries
- Every key, yours first; a security key’s certificate names its key.
- summary 🔒
- usable 🔒
- Whether a certificate may serve at all: valid under Sequoia’s policy and
not revoked as a whole. Sequoia’s
revoked(false)on a key asks that key’s own revocation, never the certificate’s: a certificate revoked as compromised still has live, unrevoked subkeys (review of 19 October 2026, N3). A revoked certificate never takes a message or a seal and never signs; it still opens what was sent to it before. - verify_
detached - Checks a detached signature of
data(multipart/signed). - wkd_
urls - Where a domain’s Web Key Directory keeps the key of
address: the advanced address, then the direct one (draft-koch-openpgp-webkey-service §3.1). - write_
key 🔒 - Writes a key file beside, then moves it in place. On Unix it is readable by you alone, whatever the umask: your secret keys, and whose keys you keep.
- write_
served 🔒 - Writes what someone’s key serves beside it.
- yours_
at 🔒 - Whether the certificate
fingerprint(hexadecimal) is one of yours in the folderroot(pgp/): kept with your keys, a security key’s read here, or one your other devices made known (cards/), as a phone knows your security key’s certificate: never kept among others’ keys, from wherever it comes again (your own mail’s Autocrypt header, a lookup). - zbase32 🔒
- z-base-32 (RFC 6189 §5.1.6), as WKD names keys.
Type Aliases§
- Signing
- A signer of yours, as Sequoia takes it: a key here (
here_signer) or on a security key (securitykey::CardSigner).