SECRECY(1)
π SECRECY(1) π
the User's Manual page, but make it make sense β¨
okay so bestie, buckle up, because this is the manual for secrecy β the command line tool that ships with libsecrecy. it does encryption and key management and it is genuinely so useful once you get the vibe. let's go π«Ά
πΈ NAME πΈ
secrecy β the libsecrecy encryption and key management tool π
β¨ SYNOPSIS β¨
secrecy createKey cipher gpgid keyname
secrecy encrypt [keyhash|keyname]
secrecy decrypt
secrecy exportKey [keyhash|keyname] gpgid
secrecy importKey gpgid
secrecy listKeys
secrecy setDefaultKey keyname
π DESCRIPTION π
so the libsecrecy distribution comes with this command line tool called secrecy, right? and rn it's got seven subcommands: createKey, encrypt, decrypt, exportKey, importKey, listKeys and setDefaultKey. seven. a whole little squad π
secrecy accepts several subcommands. but here's the thing you need to know: currently, secrecy has no arguments for reading and writing any file. none. zero. not a single one. π you have to rely on the shell's capabilities to read and write plain files, encrypted files, and key exports β using pipes and redirection operators. that's the whole move. that's the assignment. the shell does the plumbing, secrecy does the crypto. periodt.
Subcommands are the following:
π secrecy createKey cipher gpgid keyname
creates keys for libsecrecy. here's the breakdown:
ciphercan currently take the valuesAES128,AES192orAES256π₯gpgidneeds to be a valid id (normally an email address) that's present as a secret key ingpg(1)'s keyring. this is what gets used for securely storing the AES key for use by libsecrecykeynameβ you get to pick a human readable name for the key you just created, for instance"mykey"- the program outputs a key hash in the form of a hexadecimal encoded string
- either this key hash or the key name you gave can be provided to the
encryptcommand ofsecrecyfor encrypting files using the newly created key
π secrecy encrypt [keyhash|keyname]
this subcommand allows one to encrypt files. keyhash/keyname is either the hexadecimal string which was printed by createKey when creating the key, or the name given to createKey when creating the key. if the string provided is empty, then the default key name is used if any has been set; see setDefaultKey.
β οΈ note that this command needs to decrypt the key from its gpg(1) encoded form, so you will need to provide the respective passphrase in some form. no passphrase, no encryption, no cap π
π§ secrecy decrypt
this subcommand allows one to decrypt files. it needs to decrypt the key from its gpg(1) encoded form, so you will need to provide the respective passphrase in some form.
π‘ the good news? you do not need to provide the keyhash for decryption, because that information is provided inside the encrypted file. the file literally tells you which key it wants. main character energy tbh π
π¦ secrecy exportKey [keyname|keyhash] gpgid
export to an encrypted transfer format, for passing data on to third parties, via the exportKey command of secrecy. keyname or keyhash are a valid key name or hash respectively, and gpgid is a string identifying the recipient of the key. the public key of gpgid needs to be available in gpg's key database.
π secrecy importKey gpgid
import a key from the format produced by the exportKey command, using the importKey command, where gpgid designates the gpg key which will be used to locally encrypt the key for storing it in libsecrecy's database.
π secrecy listKeys
list installed keys. it prints a tabulation separated table such that the first column contains the key names and the second the respective key hash values. yes, it's a table. yes, it's giving organized. we love a tidy girlie β¨
π secrecy setDefaultKey keyname
change the default key. the default key is used when an empty keyname is used for running any command accepting a key name, with the obvious exceptions of createKey and setDefaultKey. those two are the exceptions, so don't come for me π
π FILES π
AES keys are stored encrypted using gpg(1) via gpgme. each key is assigned a hash H value at creation time. H is computed as the SHA256 checksum of a randomly generated sequence. π
keys are stored and searched for in the directory set in the environment variable LIBSECRECY_KEYDIR.
if this variable is not set, then the subdirectory .libsecrecy inside the current user's home directory β designated by the environment variable HOME β is used.
inside this directory the key for hash H is stored in the file hash/H, otherwise said:
hash/3E35C013C66C66B09E3E0B923451530C62D4346D9F5165906FC94B9B4D35E28E
where the respective files are encrypted using gpgme. the secret key used for this encryption can be set at key creation time. π
π EXAMPLES π
create an AES256 key using your GPG ID, for instance foo@example.org, and call it mykey:
$ secrecy createKey AES256 foo@example.org mykey
3E35C013C66C66B09E3E0B923451530C62D4346D9F5165906FC94B9B4D35E28E
list available keys:
$ secrecy listKeys
mykey 3E35C013C66C66B09E3E0B923451530C62D4346D9F5165906FC94B9B4D35E28E
set mykey as default key:
$ secrecy setDefaultKey mykey
encrypt file into file.encrypted, using the default key:
$ secrecy encrypt < file > file.encrypted
decrypt file.encrypted into file.decrypted, using the default key:
$ secrecy decrypt < file.encrypted > file.decrypted
prepare an export of mykey for use by the person behind GPG ID bar@example.org, whose public key should be accessible in the user's gpg(1) keyring. the key will be exported into the file export.key:
$ secrecy exportKey mykey bar@example.org > export.key
see? pipes and redirection. the shell really said "I got you bestie" π«Ά
π AUTHORS π
secrecy is a program part of the libsecrecy, written by German Tischler-HΓΆhle <germant@miltenyibiotec.de>.
the present manual page is written by Γtienne Mollier <emollier@debian.org> for the Debian project. π
π¦ SEE ALSO π¦
see the GnuPG documentation relative to key management for creating and handling gpg(1) keys.
okay that's the whole page bestie, you're officially certified π
this one's from the GNU crew, version dated 2020-11-13, and it lives at SECRECY(1). go encrypt something iconic. mwah πβ¨
π¦ where this page comes from
- debian bookworm: secrecy 0.0.5+ds-2+b1 Β· BSD-2-Clause
- debian trixie: secrecy 0.0.5+ds-4+b1 Β· BSD-2-Clause
- ubuntu jammy: secrecy 0.0.5+ds-2 Β· BSD-2-Clause
- ubuntu noble: secrecy 0.0.5+ds-3build2 Β· BSD-2-Clause
- ubuntu questing: secrecy 0.0.5+ds-4
- ubuntu resolute: secrecy 0.0.5+ds-4build2 Β· BSD-2-Clause
- ubuntu stonking: secrecy 0.0.5+ds-5 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms