date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,518,116,339,000
How to encrypt a file using the command below, if the recipient mail is not showing up when I type the --list-keys command. Sample Encrypt file command using GPG gpg --output "output_filename" --encrypt --recipient [email protected] "input_filename" Output for gpg --list-keys shows to imported public keys one is User_A which shows an email. However another one Company ABC doesn't show an email. Which command can I use to encrypt the file and send it to Company ABC where they can decrypt it using their private key? pub 2048R/4XXXX4E4 2016-08-29 uid [ultimate] User_A <[email protected]> sub 2048R/DXXXX7E 2016-08-29 pub 1024D/FXXXXX3D 2007-01-20 uid [ unknown] Company ABC sub 2048g/7XXXXXE 2007-01-20
You can use the identifier instead of an email address: gpg --output "output_filename" --encrypt --recipient FXXXXX3D "input_filename" (You should really specify the full fingerprint but that's another story.)
How to encrypt if public key does not have email
1,518,116,339,000
To install insync on my debian , i need to add an external repo . Please, save me the part that external repos can be harmful etc etc. I just need this repo. The problem is that when I try to import the gpg key, the process freezes. This is the state of the operation, it's been stuck for half an hour. ale@debian:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ACCAF35C Executing: /tmp/tmp.pgGnNotiOR/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys ACCAF35C And nothing more happens. What can I do to solve this hideous issue? Thank you all in advance
To install insync on debian , run the following command: echo "deb http://apt.insynchq.com/debian $(lsb_release -cs) non-free" | sudo tee -a /etc/apt/sources.list sudo apt-get install insync
importing gpg key freezes the terminal
1,518,116,339,000
Im decrypting a file sent by a client using gpg. The file is Obviusly encrypted, and theoretically, using my public key. I have installed both his public key and my private key. So, im running: /usr/local/bin/gpg --output a.log --decrypt --passphrase=mypassphrase --batch /usr/local/log/Banesco11052015.TXT.pgp gpg: encrypted with 2048-bit RSA key, ID B61CC86B, created 2014-11-06 "Company SRL " gpg: WARNING: message was not integrity protected But a.log is empty. I also tried as well: echo mypassphrase | gpg --output a.log --passphrase-fd 0 /usr/local/log/Banesco11052015.TXT.pgp The encrypted file has content, but is it possible though it has encrypted content, the file is actually empty on decryption? Am I running the decrypt command wrongly? Maybe there is a problem with my keys? Thanks in advance! E.
Effectively, as @PSkocik, the file was empty. Apparently, those 900 bytes on it were header information regarding the encryption. Thank you all!
GPG decrypt returns empty file
1,518,116,339,000
Why does setting umask to 0077 makes a gpg public key unavailable for apt when installing a package, e.g. umask 0077 curl -fsSLo /usr/share/keyrings/brave-browser-beta-archive-keyring.gpg https://brave-browser-apt-beta.s3.brave.com/brave-browser-beta-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/brave-browser-beta-archive-keyring.gpg] https://brave-browser-apt-beta.s3.brave.com/ stable main">/etc/apt/sources.list.d/brave-browser-beta.list apt update apt install brave-browser-beta The above does not work, I get this output: Err:4 https://brave-browser-apt-beta.s3.brave.com stable InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0B31DBA06A8A26F9 Reading package lists... Done W: GPG error: https://brave-browser-apt-beta.s3.brave.com stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0B31DBA06A8A26F9 E: The repository 'https://brave-browser-apt-beta.s3.brave.com stable InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. This does work: umask 0022 curl -fsSLo /usr/share/keyrings/brave-browser-beta-archive-keyring.gpg https://brave-browser-apt-beta.s3.brave.com/brave-browser-beta-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/brave-browser-beta-archive-keyring.gpg] https://brave-browser-apt-beta.s3.brave.com/ stable main">/etc/apt/sources.list.d/brave-browser-beta.list apt update apt install brave-browser-beta Why does setting umask to 0077 (and then downloading public key) makes a gpg public key unavailable for apt? The key was downloaded as root, and so was executed apt update, why then this issue?
apt runs download-related operations using a sandbox user by default, _apt. I can’t check right now, but it’s possible that apt update key verification is done using this user too, which would mean the keys have to be readable by the _apt user. See Why are directory permissions preventing "sudo apt install" using a file? for a similar problem.
Why does setting `umask` to `0077` (and then downloading public key) makes a gpg public key unavailable for apt?
1,518,116,339,000
Pardon me if this is not possible. My goal is to utilise pass. From the conducted research, it appears that the pass command utility will require a GPG key before you can store your sensitive data. Now, in order to generate a GPG key, one would run the following command gpg --full-generate-key which is a pre-requisite to using pass. From the output, we can see that the options to choose from are as follows: gpg (GnuPG) 2.2.27; Copyright (C) 2021 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. gpg: directory '/home/user1/.gnupg' created gpg: keybox '/home/user1/.gnupg/pubring.kbx' created Please select what kind of key you want: (1) RSA and RSA (default) (2) DSA and Elgamal (3) DSA (sign only) (4) RSA (sign only) (14) Existing key from card Your selection? As you can see, you can use RSA or DSA, despite GPG specifying that you can use AES256. gpg (GnuPG) 2.2.27 libgcrypt 1.8.8 Copyright (C) 2021 Free Software Foundation, Inc. License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Home: /home/user1/.gnupg Supported algorithms: Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256 Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Compression: Uncompressed, ZIP, ZLIB, BZIP2 Does that mean it is impossible to secure your passwords in pass using AES256 encryption method?
What you are trying to do is unfortunately not possible. AES256 is a symmetric-key algorithm, i.e. the same key is used for encrypting and decrypting. The --generate-key or --full-generate-key option of gpg is used to create an asymmetric public/private key pair, where the public key is used for encryption and the private key for decryption. Note that AES256 is listed under the options for "Cipher", not "Pubkey". That said, I can understand that you would prefer the higher security level of AES256 over RSA. It seems however that the ECDSA and ED25519 algorithms can provide similar security to AES256. To enable it in gpg2, you will need to specify the --expert option. When asked "what kind of key you want", choose (9) ECC and ECC with either NIST P-256 or Curve 25519, respectively. Both curve algorithms provide the same level of security, with ED25519 being a tiny bit faster than ECDSA.
How to specify AES-256 algorithm when creating GPG key?
1,518,116,339,000
We have a self-hosted Debian repository, from where we are fetching all the packages. While running the "apt update" on target machine, we are getting below error- W: GPG error: http://URL_FQDN/dev/debian stretch InRelease: The following signatures were invalid: EXPKEYSIG 0DD91A7623XXX9F606 devkey <[email protected]> Can someone please suggest what is wrong here? I tried below things- apt-key adv --keyserver hkp://URL_FQDN:80 --recv-keys 0DD91A7623XXX9F606 Executing: /tmp/apt-key-gpghome.NeNGQeeH3a/gpg.1.sh --keyserver hkp://URL_FQDN:80 --recv-keys 0DD91A7623XXX9F606 gpg: keyserver receive failed: No data apt-key list gives below output (expired):- apt-key list /etc/apt/trusted.gpg -------------------- pub rsa2048 2018-10-25 [SC] [expires: 2025-08-25] 89E9 375E AC23 2856 E185 4295 340E 2EE9 XXXX B486 uid [ unknown] Group <[email protected]> sub rsa2048 2018-10-25 [E] [expires: 2025-08-25] pub rsa3072 2020-09-28 [SC] [expired: 2022-09-28] B899 E7EA 6FFC D59A 152B B25A 0DD9 1A76 XXXX F606 uid [ expired] devkey <[email protected]> gpg --list-keys gives below value:- gpg --list-keys /root/.gnupg/pubring.kbx ------------------------ pub rsa3072 2020-09-28 [SC] B899E7EA6FFCD59A152BB25A0DD91A7623XXX9F606 uid [ unknown] devkey <[email protected]> sub rsa3072 2020-09-28 [E]
The key used to sign your repository’s artifacts has expired: pub rsa3072 2020-09-28 [SC] [expired: 2022-09-28] B899 E7EA 6FFC D59A 152B B25A 0DD9 1A76 XXXX F606 uid [ expired] devkey <[email protected]> You need to renew it, and update it wherever it’s used. To move the key’s expiration date, edit it with GPG: $ gpg --edit-key "B899 E7EA 6FFC D59A 152B B25A 0DD9 1A76 XXXX F606" […] gpg> expire Changing expiration time for the primary key. Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) and choose an appropriate value.
GPG error- The following signatures were invalid: EXPKEYSIG
1,518,116,339,000
This is the content of my .gnupg/gpg-agent.conf: pinentry-program /usr/bin/pinentry-curses When I try to retrieve a password from pass' store, e.g. via pass -c path/to/password in a very small-sized terminal window, the command errors like this: gpg: decryption failed: No secret key So it's an error from GnuPG, caused, I believe, by not enough space for ncurses to draw the pinentry dialog. Can anybody reproduce this? If so, where can I report this bug?
Whenever you report a (suspected) bug, you should state the behavior you observe and what you expected instead. So in this case, and as you opened a bug report with GnuPG, you should state what you think should happen. If you add it here, you should edit the question, not add it only in a comment. See also the suggestions at the bottom. Yes, this happens because the window is too small. It also doesn't originate from GnuPG: GnuPG just calls the pinentry-program you specified in the configuration. For details about what happens, we can try to call it manually. $ stty cols 20 rows 10 $ pinentry-curses OK Pleased to meet you GETPIN S ERROR curses.dialog_create 83886381 ERR 83886381 Screen or window too small <Pinentry> Here I first made the tty size small and then called pinentry-curses. It waits for a command, I typed GETPIN, the command to acquire the PIN. It complains that the screen is too small to display the dialog. GnuPG just reports that it can't get the PIN. I saw what you wrote it the ticket, but what you propose is between difficult and impossibly, because gpg should not care about terminal size, and therefor should not claim that the terminal is too small. Instead I would suggest the following text (I don't want to create an account there): gpg calls the pinentry-program if it needs to decrypt a key. It would be better for the user if pgp wouldn't display the generic message decryption failed: No secret key and instead forwarded the message from the pinentry-program, something like: Can't decrypt key, pinentry-program failed with (text from ERR response). Additionally, if pinentry-curses is maintained by the gpg team, it could detect a small windows and behave the same as when $TERM is unset, avoiding this error.
Strange error with GnuPG: claims "no secret key" when terminal is too small
1,518,116,339,000
I run a couple of PCs and they both multi-boot into more than one OS (Win10/Linux{Devuan}/FreeBSD & Win10/Linux{Devuan} respectively). I use Thunderbird + Enigmail (sticking with Version 68.x of the former for the moment as the integrated OpenGPG support coming in 78.x does not have SmartCard support working yet as I understand it). I have noted How to import secret gpg key (copied from one machine to another)? but I am not sure it can work when the Secret key(s) are held in a Smart Card such as my OpenGPG (version 3.3) one. I am aware that an issue is that the secret keys themselves are normally supposed to be generated within the card's hardware and stored only on the card itself, with a fundamental part of the security being that they cannot be extracted from that card. I am also aware that the solution to this is to do the generation on an air-gapped PC, ideally running from a OS booted from Read-only material (CD/DVD) and to export and preserve in a secure manner the complete secret primary and separately the secret sub-keys and public keys. Then, on the first machine/OS one needs to reimport just the latter two of the those three and then use the keytocard feature to transfer the secret sub-keys to the card (it is a one-way trip!) which leaves special stubs in the secring.gpg that says "yes, we have these keys but they are stored on a card". Do I need to repeat the "importing the secret-sub-keys only and then use keytocard to generate the secret-key-stubs on each subsequent machine/OS" to get the secret key ring on each machine to have an awareness for that machine/OS that we have owner keys on a SmartCard; OR is there a short-cut method (perhaps copying the user's secring.gpg securely via sneakernet from the first machine/OS to the others) that should work?
Well, if I understand correctly you have two different questions. If you generated the keys directly on the card you won't be able to back them up. If on the other hand you generated the keys on an airgapped PC and made copies to external media, then you can always retrieve them and write them to a new smart card In order to use your smart card on another computer you basically need two things, provided that you have a properly configured card reader: import the public key to your keyring insert the smart card into the reader then run gpg2 --card-status to create the stub, that is a pointer to the card for the given GPG key
How to import secret key on OpenGPG smartcard (copied from one machine/OS to another)?
1,518,116,339,000
Say I encrypt a file using my private GPG key on my desktop. I then transfer the file to my laptop, and intend to decrypt it. What do I do? I heard something about "exporting a public key", what does this mean? Do I use the private key on my laptop as well? If I do, how do I put the private key from my desktop onto my laptop? I am just transferring encrypted files between my own personal machines, I am not giving them to anyone else, so do I still need the public key? Thanks.
Encryption is done with the public key. Decryption with the private key. Keys can bei exported to files and imported on another machine. It's possible to upload the public key to a keyserver. listing keys (find your id after "/") gpg --list-keys export private key (replace 12345ABCD with your id) gpg --export-secret-keys --armor 1234ABCD > secret.asc export public key (replace username@email with your email) gpg --output public.pgp --armor --export username@email import private key gpg --import secret.asc
Using GPG keys on multiple devices?
1,518,116,339,000
Updating repositories with apt update fails since the public keys of several signatures are not available. $ sudo apt update Get:1 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB] Ign:2 http://deb.debian.org/debian stretch InRelease Hit:3 http://deb.debian.org/debian stretch Release Ign:4 http://ftp.fr.debian.org/debian stretch InRelease Ign:6 http://ftp.fr.debian.org/debian jessie InRelease Hit:7 https://fr.archive.ubuntu.com/ubuntu bionic InRelease Hit:8 http://ftp.fr.debian.org/debian stretch Release Get:5 http://ftp.fr.debian.org/debian stretch-updates InRelease [91.0 kB] Hit:9 https://riot.im/packages/debian stretch InRelease Hit:10 http://ftp.fr.debian.org/debian jessie Release Err:1 http://security.debian.org/debian-security stretch/updates InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9D6D8F6BC857C906 NO_PUBKEY 8B48AD6246925553 Get:11 https://mega.nz/linux/MEGAsync/Debian_9.0 ./ InRelease [1,480 B] Ign:12 http://download.opensuse.org/repositories/home:/strycore/Debian_9.0 ./ InRelease Hit:13 http://download.opensuse.org/repositories/home:/strycore/Debian_9.0 ./ Release Err:14 http://deb.debian.org/debian stretch Release.gpg The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010 NO_PUBKEY EF0F382A1A7B6500 Get:15 https://content.runescape.com/downloads/ubuntu trusty InRelease [2,236 B] Err:16 http://ftp.fr.debian.org/debian stretch Release.gpg The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010 NO_PUBKEY EF0F382A1A7B6500 Err:9 https://riot.im/packages/debian stretch InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E019645248E8F4A1 Err:5 http://ftp.fr.debian.org/debian stretch-updates InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010 Err:17 http://ftp.fr.debian.org/debian jessie Release.gpg The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010 NO_PUBKEY CBF8D6FD518E17E1 Err:11 https://mega.nz/linux/MEGAsync/Debian_9.0 ./ InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4B4E7A9523ACD201 Err:18 http://download.opensuse.org/repositories/home:/strycore/Debian_9.0 ./ Release.gpg The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2F7F0DA5FD5B64B9 Err:15 https://content.runescape.com/downloads/ubuntu trusty InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7373B12CE03BEB4B Reading package lists... Done W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://security.debian.org/debian-security stretch/updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9D6D8F6BC857C906 NO_PUBKEY 8B48AD6246925553 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://deb.debian.org/debian stretch Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010 NO_PUBKEY EF0F382A1A7B6500 W: Skipping acquire of configured file 'xenial/binary-amd64/Packages' as repository 'https://fr.archive.ubuntu.com/ubuntu bionic InRelease' doesn't have the component 'xenial' (component misspelt in sources.list?) W: Skipping acquire of configured file 'xenial/binary-i386/Packages' as repository 'https://fr.archive.ubuntu.com/ubuntu bionic InRelease' doesn't have the component 'xenial' (component misspelt in sources.list?) W: Skipping acquire of configured file 'xenial/i18n/Translation-en_US' as repository 'https://fr.archive.ubuntu.com/ubuntu bionic InRelease' doesn't have the component 'xenial' (component misspelt in sources.list?) W: Skipping acquire of configured file 'xenial/i18n/Translation-en' as repository 'https://fr.archive.ubuntu.com/ubuntu bionic InRelease' doesn't have the component 'xenial' (component misspelt in sources.list?) W: Skipping acquire of configured file 'xenial/dep11/Components-amd64.yml' as repository 'https://fr.archive.ubuntu.com/ubuntu bionic InRelease' doesn't have the component 'xenial' (component misspelt in sources.list?) W: Skipping acquire of configured file 'xenial/dep11/icons-64x64.tar' as repository 'https://fr.archive.ubuntu.com/ubuntu bionic InRelease' doesn't have the component 'xenial' (component misspelt in sources.list?) W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://ftp.fr.debian.org/debian stretch Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010 NO_PUBKEY EF0F382A1A7B6500 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://riot.im/packages/debian stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E019645248E8F4A1 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://ftp.fr.debian.org/debian stretch-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://ftp.fr.debian.org/debian jessie Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010 NO_PUBKEY CBF8D6FD518E17E1 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://mega.nz/linux/MEGAsync/Debian_9.0 ./ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4B4E7A9523ACD201 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://download.opensuse.org/repositories/home:/strycore/Debian_9.0 ./ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2F7F0DA5FD5B64B9 W: GPG error: https://content.runescape.com/downloads/ubuntu trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7373B12CE03BEB4B E: The repository 'https://content.runescape.com/downloads/ubuntu trusty InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. I tried to update the keys without keyring.debian.org $ gpg --recv-keys 9D6D8F6BC857C906 gpg: key 9D6D8F6BC857C906: 12 signatures not checked due to missing keys gpg: key 9D6D8F6BC857C906: "Debian Security Archive Automatic Signing Key (8/jessie) <[email protected]>" not changed gpg: Total number processed: 1 gpg: unchanged: 1 and with $ gpg --keyserver keyring.debian.org --recv-keys 9D6D8F6BC857C906 gpg: no valid OpenPGP data found. gpg: Total number processed: 0 ca-certificates is up-to-date with version 20180409 as well as debian-keyring with version 2018.03.24. I have also deleted /etc/apt/trusted.gpg as per https://serverfault.com/q/851724. @Stephen Kitt's request: $ ls -la /etc/apt/trusted.gpg.d total 28 drwxr-xr-x 2 root root 4096 Jan 2 10:42 . drwxr-xr-x 6 root root 4096 Jan 2 11:06 .. -rw-r--r-- 1 root root 10345 Jan 2 10:42 ubuntu-keyring-2012-archive.gpg -rw-r--r-- 1 root root 2796 Feb 6 2018 ubuntu-keyring-2012-archive.gpg~ -rw-r--r-- 1 root root 2794 Feb 6 2018 ubuntu-keyring-2012-cdimage.gpg $ apt policy debian-archive-keyring debian-archive-keyring: Installed: 2017.7ubuntu1 Candidate: 2017.7ubuntu1 Version table: *** 2017.7ubuntu1 500 500 https://fr.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages 500 https://fr.archive.ubuntu.com/ubuntu bionic/universe i386 Packages 100 /var/lib/dpkg/status 2017.5 500 500 http://ftp.fr.debian.org/debian stretch/main amd64 Packages 500 http://ftp.fr.debian.org/debian stretch/main i386 Packages 500 http://deb.debian.org/debian stretch/main amd64 Packages 500 http://deb.debian.org/debian stretch/main i386 Packages 2017.5~deb8u1 500 500 http://ftp.fr.debian.org/debian jessie/main amd64 Packages 500 http://ftp.fr.debian.org/debian jessie/main i386 Packages How do I resolve the issue of importing the proper keys?
You need to install Debian’s version of debian-archive-keyring, the package containing the archive keys. You currently have Ubuntu’s. (debian-keyring contains the developers’ keys.) You’ll probably have to download it manually and install it using dpkg -i (as root, or using sudo). As a longer-term fix, you should either drop Bionic from your repositories, or configure pinning correctly so that it isn’t used as an upgrade candidate by default.
Importing keys from keyring.debian.org fail
1,518,116,339,000
So I executed gpg --keyserver keys.gnupg.net --recv id as root and get this: gpg: directory '/root/.gnupg' created gpg: new configuration file '/root/.gnupg/dirmngr.conf' created gpg: new configuration file '/root/.gnupg/gpg.conf' created gpg: keybox '/root/.gnupg/pubring.kbx' created It's stuck after the last line and executing it again returns nothing. Could it be a problem with my iptables? I'm running Debian 9.1 with KDE. I also tried gpgconf --kill gpg-agent && gpgconf --kill dirmngr, ping keys.gnupg.net (that IP (194.94.127.122) doesn't seem to be the right server though?), iptables -A OUTPUT -p tcp -d {ip} --dport 11371 -j ACCEPT How to fix?
The isse you describe might very well be a firewall issue (if you wait long enough, is there a timeout message?). keys.gnupg.net in fact points to pool.sks-keyservers.net (technically implemented as a CNAME alias in DNS): $ dig CNAME keys.gnupg.net ; <<>> DiG 9.10.3-P4-Debian <<>> CNAME keys.gnupg.net ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63954 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 1280 ;; QUESTION SECTION: ;keys.gnupg.net. IN CNAME ;; ANSWER SECTION: keys.gnupg.net. 81999 IN CNAME pool.sks-keyservers.net. ;; Query time: 1 msec ;; SERVER: 192.168.0.1#53(192.168.0.1) ;; WHEN: Sat Aug 05 17:20:28 CEST 2017 ;; MSG SIZE rcvd: 80 The SKS keyserver pool on the other hand does not consist of a single keyserver, but a whole pool of them, all synchronizing among each other. In fact, you can operate your own key server which will automatically be added to the network. This is a random selection of servers in the current pool return whenever the pool domain is queried: $ host pool.sks-keyservers.net pool.sks-keyservers.net has address 81.187.55.68 pool.sks-keyservers.net has address 155.94.209.99 pool.sks-keyservers.net has address 195.181.242.148 pool.sks-keyservers.net has address 37.97.128.99 pool.sks-keyservers.net has address 80.108.201.53 pool.sks-keyservers.net has address 176.9.147.41 pool.sks-keyservers.net has address 178.254.42.45 pool.sks-keyservers.net has address 130.206.1.111 pool.sks-keyservers.net has address 130.133.110.62 pool.sks-keyservers.net has address 190.202.122.122 pool.sks-keyservers.net has IPv6 address 2001:41d0:1:ac90::1 pool.sks-keyservers.net has IPv6 address 2a00:f820:177:0:84:200:66:125 pool.sks-keyservers.net has IPv6 address 2a03:b0c0:1:d0::18c2:6001 pool.sks-keyservers.net has IPv6 address 2610:81:3001:53::231 pool.sks-keyservers.net has IPv6 address 2607:5300:60:3308::1 pool.sks-keyservers.net has IPv6 address 2a01:7e00::f03c:91ff:fe69:8da9 pool.sks-keyservers.net has IPv6 address 2001:648:2ffc:1225:a800:1ff:fee4:5da4 pool.sks-keyservers.net has IPv6 address 2001:4c80:40:628:5c70:d1ff:fe44:1424 pool.sks-keyservers.net has IPv6 address 2600:3c03::f03c:91ff:fe96:bd1a pool.sks-keyservers.net has IPv6 address 2a02:7b40:c3b5:f294::1 This also means you cannot define a firewall rule for a single static IP (not even a bunch of, as they change regularly) to connect to keys.gnupg.net. There are a few key servers operated by well-known entities with rather stable service, for example: pgp.mit.edu keyserver.ubuntu.com pgp.surfnet.nl pgp.uni-mainz.de If you are required to choose a single IP because of necessary firewall restrictions, you might want to go for one of them (but still they might go offline or change IPs from time to time, of course).
GPG key import stuck at "gpg: keybox '/root/.gnupg/pubring.kbx' created" / Getting "gpg: keyserver receive failed"
1,497,996,244,000
Example : bash$ gpg --batch --edit-key alice quit >/dev/null 2>&1 Secret key is available. pub 2048R/9F07612A created: 2017-06-20 expires: never usage: SCEA trust: ultimate validity: ultimate sub 2048R/23B3A24B created: 2017-06-20 expires: never usage: SEA [ultimate] (1). alice (alice's key) <[email protected]> I know that using --batch will do the job. But my question is more "how does GnuPG achieves this 'output anyway' feature"?
Probably by writing to /dev/tty or equivalent, that's what ssh does. $ hi() { echo hello > /dev/tty; } $ hi &>/dev/null hello On Linux, at least, opening /dev/tty opens the controlling terminal of the process.
How does GnuPG outputs to console while stdout and stderr are both redirected to /dev/null
1,497,996,244,000
I'm running NetBSD on a Xen VPS, and I'm trying to generate a gpg keypair. I've gotten most of the way there, but now I'm getting the following error message: Not enough random bytes available. Please do some other work to give the OS a chance to collect more entropy! (Need 300 more bytes) This has been the status for about 10 hours now, and I've been doing things like installing packages from source in another session. Is the process hung? Is this a known-issue of some sort? Can it really take that much effort to generate 300 bytes of entropy? Thanks. UPDATE: The source of this issue is that NetBSD domU's don't have an entropy source enabled by default. You should manually enable the network interfaces as a source of entropy using the rndctl utility.
It should not. I would try restarting the process. In addition to that, there is not so much you can do, in addition to digging to source code to see what is wrong. As you probably already know, if your server is completely empty, it is possible that generating random data takes long time. However, installing packages and poking around should be enough to fix that.
How long should it take to generate 300 bytes of entropy on a VPS?
1,497,996,244,000
I want to import/refresh a gpg key from a keyserver including all non self-signatures. Whenever I try to do this gpg says, for example gpg: key <number>: number of dropped non-self-signatures: 24 [...] gpg: Total number processed: 1 gpg: unchanged: 1 As per the documentation this seems to be a desirable behavior in order to avoid importing keys flooded with bogus signatures, however I cannot get gpg to do what I want. I have tried importing/refreshing keys with gpg --verbose --import-options no-self-sigs-only --keyserver keyserver.ubuntu.com --recv-keys <fingerprint> but the output is the same.
Solved it. The right flag was --keyserver-options no-self-sigs-only, so for example gpg --verbose --keyserver-options no-self-sigs-only --keyserver keyserver.ubuntu.com --refresh-keys
GPG drops all non-self-signatures
1,497,996,244,000
I have added a new source deb http://httpredir.debian.org/debian buster-backports main contrib to my source list file on my raspberry pi. When I update my sudo apt to confirm the changes, I get this error: sudo apt update Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease Get:2 http://httpredir.debian.org/debian buster-backports InRelease [46.7 kB] Get:3 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB] Err:2 http://httpredir.debian.org/debian buster-backports InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 Get:4 http://archive.raspberrypi.org/debian buster/main armhf Packages [330 kB] Reading package lists... Done W: GPG error: http://httpredir.debian.org/debian buster-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 E: The repository 'http://httpredir.debian.org/debian buster-backports InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. I was given these instructions to follow: gpg --recv-keys 04EE7237B7D453EC gpg --recv-keys 648ACFD622F3D138 gpg --export 04EE7237B7D453EC | sudo apt-key add - gpg --export 648ACFD622F3D138 | sudo apt-key add - But when I carry out this command: gpg --recv-keys 04EE7237B7D453EC I get this error: gpg: key E0B11894F66AEC98: new key but contains no user ID - skipped gpg: Total number processed: 1 gpg: w/o user IDs: 1 Should that output occur? I followed the instructions but still got the previous errors, public key is not available implies their is something wrong with my keys.
I found the answer: The package manager needs to have the PGP keys to verify package sets from the new repository. You first have to fetch the keys from a keyserver, e.g. the SKS one: $ gpg --recv-keys --keyserver ipv4.pool.sks-keyservers.net 04EE7237B7D453EC gpg: key E0B11894F66AEC98: public key "Debian Archive Automatic Signing Key (9/stretch) <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1 $ gpg --recv-keys --keyserver ipv4.pool.sks-keyservers.net 648ACFD622F3D138 gpg: key DC30D7C23CBBABEE: public key "Debian Archive Automatic Signing Key (10/buster) <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1 then import them into your local APT key store: $ gpg --export 04EE7237B7D453EC | sudo apt-key add - OK $ gpg --export 648ACFD622F3D138 | sudo apt-key add - OK Then your apt update should work.
GPG keys new key but contains no user ID
1,497,996,244,000
I'm trying to get my GPG configuration back to a sane size. I've just converted pubring.gpg to pubring.kbx using migrate-pubring-from-classic-gpg, but despite only containing a few dozen public keys those files are both almost 30 MB. Please correct me if I'm wrong about the normal size of keys, but I suspect this might be because of certificate spamming. So I'm trying to figure out which keys are causing this massive file size (and reducing any GPG-related commands to mush), if that is even meaningful outside of the keys' bit size.
On-disk key sizes are related to the number of signatures, so one way to find out which keys to investigate is to run something like gpg2 --with-colons --list-keys --with-sig-list | awk -F: 'function dump(key, uid, sigs) { if (key && uid) { printf "%s: %d (%s)\n", key, sigs, uid } } /^pub/ { dump(key, uid, sigs); key = $5; sigs = 0 } /^uid/ { dump(key, uid, sigs); uid = $10; sigs = 0 } /^sig/ { sigs++ } END { dump(key, uid, sigs) }' | sort -n -k2,2 (This mis-counts slightly since subkey signatures are included, but the error isn’t significant.) Non-spammed keys shouldn’t show more than a few thousand signatures; the largest key in my (cleaned up) keyring is Werner Koch’s 0xF2AD85AC1E42B367, which shows 4,773 sig entries and occupies less than one megabyte. To see a key’s size in your keyring, run gpg2 --export ${keyid} | wc -c
How to get GPG public key sizes?
1,497,996,244,000
I installed the Enigmail mail encryption plugin for Thunderbird and created a key-pair as the installation wizard instructed me. I can send and encrypt/decrypt mail with this key. However, when I want to list my keys in the terminal using gpg --list-keys I get no output what so ever. Why?
Enigmail's plugin separates itself from the standard gpg keyring. That's why you don't see any output. If you for any reason want to have your public (and private) key stored also in the gpg keyring, just do the following, supposing you have your public and possibly even private key stored in one file named MyNewKey.asc: gpg --import MyNewKey.asc Example output of adding the private key to the gpg keyring: gpg: key E46008C3: secret key imported gpg: key E46008C3: "Vlastimil Burián <[email protected]>" not changed gpg: key E46008C3: "Vlastimil Burián <[email protected]>" not changed gpg: Total number processed: 2 gpg: unchanged: 2 gpg: secret keys read: 1 gpg: secret keys imported: 1 If you don't know how to get the keys from inside Enigmail to a file: Thunderbird menu (F10) -> Enigmail -> Key Management -> select your key -> right click -> Export Keys to File -> Export Secret Keys.
I created a encryption key-pair in Enigmail, but I can't see it when I do `gpg --list-keys` in terminal
1,497,996,244,000
I'm trying to add a key to gpg: $ gpg --recv-key 12345 gpg: keyserver receive failed: No keyserver available Then I do this: $ gpg --list-keys gpg: /home/me/.gnupg/trustdb.gpg: trustdb created but the error remains. How can I can fix it?
You should specify a keyserver to use.I typically use --keyserver wwwkeys.uk.pgp.net (you can use a lot of different country codes instead of uk, but I know that one works).
Unable to add a key to gpg
1,497,996,244,000
Is it possible to encrypt pictures and other files like audio etc with GPG? If yes then how to? If not then why not?.
Yes this is possible. gpg normally handles files as binary and you don't have to do anything special to encrypt pictures or audio. gpg -c yourfile.mp3 for symmetric encryption and gpg -e yourfile.mp3 to encrypt with your (pregenerated) private key.
Encrypt multimedia files with GPG
1,497,996,244,000
I want to change my gpg passphrase so I do tweedleburg:~/.gnupg # gpg --list-secret-keys /root/.gnupg/secring.gpg ------------------------ sec 1024D/43E855BB 2008-02-03 uid Thorsten Staerk <[email protected]> ssb 2048g/2220D430 2008-02-03 So I do have a secret key and a user id. But gpg is not accepting it: tweedleburg:~/.gnupg # gpg --passwd gpg (GnuPG) 2.0.26; Copyright (C) 2013 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. usage: gpg [options] --passwd <user-id> tweedleburg:~/.gnupg # gpg --passwd [email protected] gpg (GnuPG) 2.0.26; Copyright (C) 2013 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. gpg: error changing the passphrase for `[email protected]': No secret key what am I doing wrong?
Specify the numeric id: gpg --passwd 43E855BB
gpg will not let me change my passphrase
1,497,996,244,000
I have copied my GPG keys from 1 server to another, on the first server everything is working correctly, on the new I get the following: (I have included the output of list-keys and list-secret-keys [www@localhost data]$ gpg escs_hr_feed.pgp You need a passphrase to unlock the secret key for user: "Encrypt <[email protected]>" 2048-bit RSA key, ID 8E7BFE3A, created 2015-06-24 (main key ID B943D3E2) gpg: cancelled by user gpg: encrypted with 2048-bit RSA key, ID 8E7BFE3A, created 2015-06-24 "Encrypt <[email protected]>" gpg: public key decryption failed: General error gpg: decryption failed: No secret key [www@localhost data]$ gpg --list-keys /home/www/.gnupg/pubring.gpg ---------------------------- pub 2048R/B943D3E2 2015-06-24 uid Encrypt <[email protected]> uid Master <[email protected]> sub 2048R/8E7BFE3A 2015-06-24 sub 2048R/6E704692 2015-06-24 [www@localhost data]$ gpg --list-secret-keys /home/www/.gnupg/secring.gpg ---------------------------- sec 2048R/B943D3E2 2015-06-24 uid Master <[email protected]> uid Encrypt <[email protected]> ssb 2048R/8E7BFE3A 2015-06-24 ssb 2048R/6E704692 2015-06-24
So the problem turned out to be that if you sudo su - to the user, you cannot use gpg, you need to log directly in as the user. (At least on my companies server setup)
GPG keys copied, not working
1,497,996,244,000
I have about twenty files symmetrically encrypted with CAST5. I have a single passphrase that is meant to work with all of the files and I wish to confirm that it does. I wrote a script to perform a check a check on each file. read pass for file in *.gpg ; do if ! gpg --batch --passphrase "$pass" -d "$file" &>/dev/null ; then echo "Passphrase invalid for '$file'." fi done My method of checking to see if the passphrase is valid for each file requires the decryption of the entire file, which is extremely slow. Is there a quicker way to do what I am attempting to do?
Unfortunately there is no way of asking gpg-agent whether a key is passphrase protected. But you need not check the files but each key once only. Thus you should first check which keys are involved. There is no need to check the same key twice (by using it to decrypt two files). I have to admit that though I consider myself a GnuPG expert I don't get this done in an elegant way thus I have just asked on the GnuPG mailing list. I will edit this answer when I have the info from there. Edit 1 Took the masters a few minutes only... The solution is: --list-only gpg --status-fd 1 --list-only --list-packets file.gpg | awk '$2 == "ENC_TO" {print "0x" $3; }' gives you the key ID(s). Before you try to decrypt a file you check whether one of its recipient keys is in the list of keys which you have already checked. The slow operation is the asymmetric decryption. Nonetheless you should sort the files by size and start with the smallest. The above command gives you the subkey (if it was encrypted for a subkey). If you want to be really good then you don't compare the subkeys but the respective main keys. In every normal installation the main key and the subkeys have the same passphrase (with GnuPG you even have to fight to give them different passphrases).
Checking if a passphrase is able to decrypt symmetrically encrypted files
1,497,996,244,000
I have a licence that I'm signing with: gpg --default-sig-expire "2024-02-14" --sign licence This results in: $ gpg --verify licence.gpg gpg: Signature made Tue 13 Feb 2024 08:18:39 AM CET gpg: using RSA key 1234567890ABCDEF1234567890ABCDEF gpg: issuer "[email protected]" gpg: Good signature from "Stewart <[email protected]>" [ultimate] gpg: Signature expires Wed 14 Feb 2024 12:00:00 PM CET The 12:00:00 PM CET is my problem. I'm usually going for lunch at that time. I'd rather not get phone calls about systems going offline while I'm at lunch. Is it possible to specify the time? I'd rather it expired at 13:00:00 PM CET. --ask-sig-expire only prompts you for the number of days/weeks/years: $ gpg --ask-sig-expire --sign licence Please specify how long the signature should be valid. 0 = signature does not expire <n> = signature expires in n days <n>w = signature expires in n weeks <n>m = signature expires in n months <n>y = signature expires in n years Signature is valid for? (0) ISO 8601 doesn't seem supported: $ gpg --default-sig-expore "2024-02-14T13:00:00+02:00" --sign licence gpg: '2024-02-14T13:00:00+02:00' is not a valid signature expiration The man systemd.time specification doesn't seem supported $ gpg --default-sig-expire "2024-02-14 13:00:00" --sign licence gpg: '2024-02-14 13:00:00' is not a valid signature expiration The man page also doesn't suggest that a time is possible: --default-sig-expire The default expiration time to use for signature expiration. Valid values are "0" for no expiration, a number followed by the letter d (for days), w (for weeks), m (for months), or y (for years) (for example "2m" for two months, or "5y" for five years), or an absolute date in the form YYYY-MM-DD. Defaults to "0". The only solution I've found, is to change my system's time zone to the next timezone west of me, then sign, then set my system's time zone back to my original time. $ sudo mv /etc/localtime{,.backup} $ sudo ln -s /usr/share/zoneinfo/Europe/London /etc/localtime $ gpg --default-sig-expire "2024-02-14" --sign licence $ sudo mv /etc/localtime{.backup,} $ gpg --verify licence.gpg gpg: Signature made Tue 13 Feb 2024 08:18:39 AM CET gpg: using RSA key 1234567890ABCDEF1234567890ABCDEF gpg: issuer "[email protected]" gpg: Good signature from "Stewart <[email protected]>" [ultimate] gpg: Signature expires Wed 14 Feb 2024 01:00:05 PM CET
The only format accepted by --default-sig-expire with a time specification is YYYYMMddTHHmmss[Z]: gpg --default-sig-expire 20240214T130000 --sign license Any timezone specifier is ignored, and daylight savings time is ignored too; so currently in Europe this produces an expiration time one hour later than the time specified. Processing time also affects the ultimate signature expiry; for example, if gpg prompts for anything (e.g. to confirm overwriting an existing signed file), the incurred delay pushes the expiration back. To check this, look for the --default-sig-expire definition, then determine that the option’s value is parsed using parse_expire_string, which knows about a number of formats. The only one of those which accepts an absolute timestamp including hours, minutes, and seconds, is isotime2epoch (and its 64-bit time_t variant), with a comment specifying The only supported format is "yyyymmddThhmmss[Z]" delimited by white space, nul, a colon or a comma.
gpg expiration TIME?
1,497,996,244,000
Suppose Bob got a message from Alice encrypted with his public key and signed with her private key. Now he wants to prove to Charlie that he got a message from her with this exact content. The message was created via gpg --sign --encrypt. My idea was that he could decrypt the message and save it with its signature somewhere but I could find no way to achieve this. But since GPG signs the message and then encrypts it afterwards this should at least theoretically be possible. Now how can he do this or do you have any other ideas how Bob can proof the message authenticity to Charlie? Restrictions: Giving Charlie Bobs private key is (obviously) not an option. Communication is only possible via email. Alice cannot be contacted any more so resending the message or Charlie and Alice communicating with each other is not possible. Bob has to work with what he already has.
This was pretty hard to find. It is not in local man gpg. The command: gpg -vi --unwrap msg1.gpg (-v means verbose, -i is interactive, does not overwrite files.) Caveat: You might(?) need to decompress the output sometimes. Documentation: https://gnupg.org/documentation/manuals/gnupg.pdf --unwrap This command is similar to ‘--decrypt’ with the difference that the output is not the usual plaintext but the original message with the encryption layer removed. Thus the output will be an OpenPGP data structure which often means a signed OpenPGP message. Note that this option may or may not remove a compression layer which is often found beneath the encryption layer. Testing (on Ubuntu, fresh in August 2023). ### Alice(=testS) signed a message and encrypted it ### using Bobs(=test) public key. -r means --recipient [0] $ echo A message to be signed a sent > message [0] $ gpg -u testS -r test --sign --encrypt message ## Alice sent message.gpg to Bob [0] $ gpg -vi --unwrap message.gpg # --output ... gpg: WARNING: no command supplied. Trying to guess what you mean ... gpg: public key is 3DF37C69945F312D gpg: using subkey 3DF37C69945F312D instead of primary key 96B43A891E43F2F4 gpg: using subkey 3DF37C69945F312D instead of primary key 96B43A891E43F2F4 gpg: encrypted with 3072-bit RSA key, ID 3DF37C69945F312D, created 2023-08-29 "TEST TE <[email protected]>" gpg: AES256 encrypted data File 'message' exists. Overwrite? (y/N) n Enter new filename: message-only-singed.gpg ## Bob sends "unwrapped" (=deciphered) file message-only-signed.php ## to Charlie [0] $ gpg -d message-only-singed.gpg A message to be signed a sent <---- The message gpg: Signature made Tue 29 Aug 2023 22:55:11 CEST gpg: using RSA key 6646102A06EC96A49AE8828FCDF0F02D337492DD gpg: issuer "[email protected]" gpg: Good signature from "tests <[email protected]>" [ultimate] <---- the sig ### Charlie sees that Alice=testS signed the message (The last command can be used with --output file.)
Convert encrypted and signed to just signed PGP message
1,497,996,244,000
An issue based on this post. If you want to trust a public key, two commands can achieve the target: gpg --edit-key someone's_public_key gpg --sign-key someone's_public_key The obvious point that i can find is you have 6 choice to choose in --edit-key: gpg> sign 1 = I don't know or won't say 2 = I do NOT trust 3 = I trust marginally 4 = I trust fully 5 = I trust ultimately m = back to the main menu Is gpg --sign-key someone's_public_key = gpg --edit-key someone's_public_key (option 5)? What is the other main points between them?
My man gpg says: --sign-key name Signs a public key with your secret key. This is a shortcut version of the subcommand "sign" from --edit. As there is no option --edit, but there are --edit-key and --edit-card, I'd assume they meant --edit-key, and it is indeed the same (modulo defaults for choices).
The difference between sign-key and edit-key
1,497,996,244,000
I would like to use apt-cacher as my package proxy locally. Especially when I rebuilding my Docker image several times in a row. I have apt-cacher installed and running on my system. I set my proxy address to: http://melroy-pc:3142 (melroy-pc is my hostname). In my case I create a /etc/apt/apt.conf.d/02proxy file: Acquire::http::proxy "http://melroy-pc:3142"; Acquire::https::proxy "http://melroy-pc:3142"; (I already tried to only define http::proxy (without https), I also tried to add APT::Get::AllowUnauthenticated "true";, all WITHOUT any luck) After which I just run my apt commands (apt update & apt install). Which causes issues now: Step 9/41 : RUN apt-get update && apt-get install -y --no-install-recommends dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libassuan0 libksba8 libldap-2.4-2 libldap-common libnpth0 libreadline8 libsasl2-2 libsasl2-modules libsasl2-modules-db libsqlite3-0 libssl1.1 lsb-base pinentry-curses readline-common apt-transport-https ca-certificates curl software-properties-common apt-utils net-tools ---> Running in af278cee1d52 Err:1 http://deb.debian.org/debian bullseye InRelease 403 Access to cache prohibited [IP: 192.168.2.166 3142] Err:2 http://security.debian.org/debian-security bullseye-security InRelease 403 Access to cache prohibited [IP: 192.168.2.166 3142] Err:3 http://deb.debian.org/debian bullseye-updates InRelease 403 Access to cache prohibited [IP: 192.168.2.166 3142] Reading package lists... E: The repository 'http://deb.debian.org/debian bullseye InRelease' is not signed. E: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease 403 Access to cache prohibited [IP: 192.168.2.166 3142] E: Failed to fetch http://security.debian.org/debian-security/dists/bullseye-security/InRelease 403 Access to cache prohibited [IP: 192.168.2.166 3142] E: The repository 'http://security.debian.org/debian-security bullseye-security InRelease' is not signed. E: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease 403 Access to cache prohibited [IP: 192.168.2.166 3142] E: The repository 'http://deb.debian.org/debian bullseye-updates InRelease' is not signed. Important note: My packages are all getting successfully installed, without any issues, when I do NOT use the proxy. This approach used to work in the past, when I was using apt-key instead of gpg (I don't know if it's related, see my other question).
As @cas pointed out, Docker host is typically using a private IP address in another local IP block. And by default apt-cacher after version 1.7.0 is using allowed_hosts = '' as default value instead of *. Solution for me: uncomment allowed_hosts setting and put the value to * in /etc/apt-cacher/apt-cacher.conf file: allowed_hosts = * This will allow all IP addresses (including the Docker IPs). Of course you can also specify a specific range.
Unable to use apt-cacher
1,497,996,244,000
In the past gpg/gpg2 used to run flawlessly on my MacOS laptop running macports. In the last few month (years?) it seems to have stopped being operational and after spending many hours in trying to get it to work again i wonder wether the root problem is much more severe after i saw that https://dev.gnupg.org/T3717 I am tired of errors like Connection Closed in DNS, Server Indicated a Failure, No Keyserver Available, and Not Enabled when trying to do something with a keyserver is closed. See also https://lists.gnupg.org/pipermail/gnupg-users/2021-March/064922.html along the same lines One of my issues is that error messages in my environment are displayed in german so that a web search does not alway reveal the proper results. After i moved to a new laptop i recreated a key according to what i thought was the correct way to do it and then wanted to send it to the gpg infrastructure which failed. My old key is expired and somehow still being used by maven central and this is the original issue that i want to solve. The story will probably be long so let's start with the basics: I assume we are talking about: https://en.wikipedia.org/wiki/GNU_Privacy_Guard as documented in: https://www.gnupg.org/documentation/index.html There is a macports implementation of it which i am using on Mac OS Big Sur 11.5.2: gpg --version gpg (GnuPG) 2.2.29 libgcrypt 1.9.3 Copyright (C) 2021 Free Software Foundation, Inc. License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Home: /Users/wf/.gnupg Unterstützte Verfahren: Öff. Schlüssel: RSA, ELG, DSA, ECDH, ECDSA, EDDSA Verschlü.: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256 Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Komprimierung: nicht komprimiert, ZIP, ZLIB, BZIP2 gpg --list-keys will happily display a key which expires in 2023 From the sonatype I get a message: ERROR] Repository "..." failures [ERROR] Rule "signature-staging" failures [ERROR] * No public key: Key with id: (...) was not able to be located on &lt;a href=http://keyserver.ubuntu.com:11371/&gt; so i assume i have to let the keyserver receive my new key and tell sonatype to use that new key. gpg --send-keys <key> gpg: sende Schlüssel ... auf hkps://keyserver.ubuntu.com gpg: Senden an Schlüsselserver fehlgeschlagen: Network is unreachable is the starting point of my problems. gpg --send-keys --keyserver http://keyserver.ubuntu.com:11371 <key> has the same effect. https://qastack.com.de/unix/361642/keyserver-receive-failed-on-every-keyserver-available did not have a fitting answer for me using the option from the FAQ Document https://gnupg.org/faq/gnupg-faq.html --keyserver pool.sks-keyservers.net gives the same error message: Network is unreachable which in this case makes even sense given that: ping pool.sks-keyservers.net ping: cannot resolve pool.sks-keyservers.net: Unknown host while ping keyserver.ubuntu.com PING keyserver.ubuntu.com (162.213.33.8): 56 data bytes so the same error message is displayed no matter whether the host is pingable or not ... I think that is a bug - the message should be more detailed ... How can I get gpg running and send/receive keys in this environment? Links that did not help me: https://www.gnupg.org/documentation/manuals/gnupg-devel/Dirmngr-Options.html https://superuser.com/questions/931812/receiving-a-key-from-a-keyserver-in-gnupg keyserver receive failed (on every keyserver available)
For the time being my work around is to use a unix machine instead. So first 1 transferred the key to my unix box: gpg --export-secret-key 35...DEF | ssh server gpg --batch --import gpg: key D38 ... not changed gpg: key D38 ...: secret key imported gpg: Total number processed: 1 gpg: unchanged: 1 gpg: secret keys read: 1 gpg: secret keys imported: 1 and then sent it from there: gpg --send-keys --keyserver keyserver.ubuntu.com 35.. gpg: sending key D38... to hkp://keyserver.ubuntu.com please note that the default keyserver on that machine failed: .. hkp://hkps.pool.sks-keyservers.net gpg: keyserver send failed: No name Helpful links: https://stackoverflow.com/a/3176373/1497139 https://superuser.com/a/1327486/166461 https://stackoverflow.com/a/68132500/1497139
Is there a way to get gpg/gpg2 work with macOS macports in 2021?
1,497,996,244,000
I'd like to use mutt to send and sign the email directly from command line like e.g. mutt -s "MySubject" [email protected] < message OR echo " " | mutt -s "MySubject" -a message.txt -- [email protected] but even I made a proper setup in muttrc and it actually works when I compose the email in mutt UI (agent interface) ["Security: Sign (PGP/MIME)" and "Sign as:Marcel" parameters are automtically assigned + activated and email is sent with signature] this I can't make functional within cli usage. It just send the email without any signature in it. I tried different setup in muttrc but it always send the mail without it. Another unsuccesfull attempts- pgp key with and without passphrase to check if there is not a problem with entering it, also it did not work with key that was temporary unlocked by pgp agent. GPG variables defined in my muttrc: ... source ~/.config/mutt/gpg.rc set pgp_use_gpg_agent="yes" set pgp_default_key="8624C27DB543F03D" set pgp_sign_as="Marcel" set crypt_autosign="yes" You can see even if I pass the muttrc config file in argument it does not change the fact that mutt just send the email without using pgp. It seems to me it ignores the variables in the config because it's not launched in agent UI. mutt -F ~/.config/mutt/muttrc -s "MySubject" -a message.txt -- [email protected] Is there a way to sign the mail with mutt when using only command line? Thank you for your answers.
Kevin J. McCarthy responded to a related question on the mutt user mailing list saying: Sorry, cryptographic operations are disabled in batch mode. Source: http://lists.mutt.org/pipermail/mutt-users/Week-of-Mon-20210412/002737.html
signing email with PGP key outside Mutt UI interface
1,497,996,244,000
I am learning how to use gpg, and I would like create multiple keys for different purposes, for example one to encrypting my emails, anther for connecting to ssh, yet another for pass password store. I can see this quickly getting out of hands where I loose track of which key did I use for ssh etc. So my question is how can I stay organized? Is there a way to append keys or subkeys with names or some tagging system? Or I am thinking about this the wrong way and I shouldn't look at gpg itself to organize my keys? I know that this question is kind of open ended and possibly opinionated but I'm just not sure what security practices are recommended here.
GPG (sub)keys used for SSH authentication must have usage A (Authentication) and in practice that usage isn't used for anything else, so selectively setting that could be enough to identify your SSH key(s). In older versions it was hard to set/change or even see the usage flags, but modern GPG it is better: see How are the GPG usage flags defined in the key details listing? https://security.stackexchange.com/questions/31614/how-to-change-subkey-usage-of-a-pgp-key https://superuser.com/questions/833875/how-do-i-display-the-usage-flags-for-my-encryption-keys-in-a-less-hackish-way https://security.stackexchange.com/questions/206072/how-do-i-interpret-output-that-produces-gpg-listing-keys but be cautious of the dates of each. If you use gpg --full-gen-key it allows you to enter 'Real name', 'Email address', and 'Comment' all of which go in the userid record, which is shown when you list or otherwise look at keys. Obviously you can put any information you want in comment; less obviously you can do so in the other fields. PGP was originally designed to be used for email, so it was intended that keys be associated with people, or email addresseses which appear stable to outsiders but are actually shared and/or transferred between people such as a business department or 'listserv', but this is only an intent -- programs like GPG can process any correctly formatted data whether or not it actually was received or will be sent as email. Note however the userid info is included in the publickey, and can be seen by anyone your publickey is distributed to -- which may be many if you use common or default methods of distribution like a keyserver. Labelling a key "[email protected] (use this key for github)" and giving that key to github to verify your commits is probably a good idea. Labelling a key "(remember this is not the right key for my child pornography files)" is probably a bad idea. Also note userid info is only at the masterkey level not subkey, so it doesn't easily help distinguish subkeys -- but then most PGP programs, including GPG, usually operate only on the masterkey and don't make it very easy to select or even identify subkeys for most operations.
Give keys/subkeys in gpg names
1,497,996,244,000
I have an application, run as a service by a system user, which uses GPG (using libgpgme in C). This user has no home directory and I would like to eliminate password caching. Therefore I'd like gpg-agent to be started with --homedir=/opt/myapp/.gnupg --default-cache-ttl 0. gpg-agent(1) says: The agent is automatically started on demand by gpg, gpgsm, gpgconf, or gpg-connect-agent. Thus there is no reason to start it manually. This leads me to a few of questions: How should one start gpg-agent for a specific home-dir with specific command-line options? If gpg-agent is already running, is it possible to change the homedir/default-cache-ttl or should I kill the existing agent? Will killing the existing gpg-agent affect other (non-system) users? For question1: gpg-connect-agent --homedir /opt/myapp/.gnupg /bye creates a new gpg-agent with that homedir, but any other agents continue to run. Which gpg-agent will be used when we sign? For question 2: I tried the following. However, homedir does not appear as an option in --list-options gpg-agent and while I saw the new values refresh during --list-options, I was still able to sign files without a password. echo "default-cache-ttl::0" | gpgconf --change-options gpg-agent echo "max-cache-ttl::0" | gpgconf --change-options gpg-agent
How should one start gpg-agent for a specific home-dir with specific command-line options? In the service file use Environment=GNUPGHOME=/opt/myapp/.gnupg. gpg-agent is started automatically when calling gpg (or using necessary functions in libgpgme). By setting $GNUPGHOME, the gpg/gpgme calls will connect to an existing gpg-agent with --homedir=/opt/myapp/.gnupg or spawn a new gpg-agent if a suitable one doesn't exist already. If gpg-agent is already running, is it possible to change the [...]default-cache-ttl or should I kill the existing agent? From gpgconf(1): "The gpgconf is a utility to automatically and reasonable safely query and modify configuration files in the ‘.gnupg’ home directory. It is designed not to be invoked manually by the user..." All you really need to do to set the default-cache-ttl is ensure that $GNUPGHOME/gpg-agent.conf exists and contains default-cache-ttl 0. Note that this needs to exist before the new instance of gpg-agent is created. Therefore either ensure this file is installed with the application, or since this is a service use ExecStartPre= to run something that sets this. Will killing the existing gpg-agent affect other (non-system) users? There should be no need to kill gpg-agent. Since this is run in a service, any spawned gpg-agents are isolated to the service's cgroup. When the service is stopped, spawned gpg-agents will be killed by systemd. Note: I am only reasonably sure about the paragraph above. I noticed that when I was testing gpg-connect-agent in ExecStartPre= systemd gave a warning that gpg-agent still existed in the cgroup and was killed.
Starting gpg-agent with specific options
1,497,996,244,000
I am trying to install latest R package on Debian Stable (Buster) following instructions on this page: https://cloud.r-project.org/ I added following to /etc/apt/sources.list: deb https://cran.csiro.au/bin/linux/debian buster-cran35/ However, when I run sudo apt-get update, I get following error: $ sudo apt-get update Hit:1 http://deb.debian.org/debian buster InRelease Hit:2 http://deb.debian.org/debian-security buster/updates InRelease Hit:3 http://deb.debian.org/debian buster-updates InRelease Hit:4 http://deb.debian.org/debian buster-backports InRelease Get:5 https://cran.csiro.au/bin/linux/debian buster-cran35/ InRelease [4,375 B] Err:5 https://cran.csiro.au/bin/linux/debian buster-cran35/ InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCAE2A0E115C3D8A Reading package lists... Done W: GPG error: https://cran.csiro.au/bin/linux/debian buster-cran35/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCAE2A0E115C3D8A E: The repository 'https://cran.csiro.au/bin/linux/debian buster-cran35/ InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. I cannot get rid of this GPG error despite following attempts: sudo apt-get install debian-keyring sudo launchpad-getkeys sudo aptitude install debian-archive-keyring How can I solve this error?
You need to import the archive key, using the id given in the error message (assuming you trust the repository): apt-key adv --keyserver keys.gnupg.net --recv-key FCAE2A0E115C3D8A
Not able to install latest R statistical package in Debian Stable
1,497,996,244,000
When I run gpg2, I'm prompted for a password every time I use it. Based on my reading of the gpg-agent man pages, I should only be prompted the first time. gpg-agent is a daemon to manage secret (private) keys independently from any proto-col. It is used as a backend for gpg and gpgsm as well as for a couple of other utilities. The agent is automatically started on demand by gpg, gpgsm, gpgconf, or gpg-connect-agent. Thus there is no reason to start it manually. ... --default-cache-ttl n Set the time a cache entry is valid to n seconds. The default is 600 sec- onds. Each time a cache entry is accessed, the entry's timer is reset. To set an entry's maximum lifetime, use max-cache-ttl. --max-cache-ttl n Set the maximum time a cache entry is valid to n seconds. After this time a cache entry will be expired even if it has been accessed recently or has been set using gpg-preset-passphrase. The default is 2 hours (7200 seconds). If I'm reading this correctly, invoking gpg2 should prompt for a password the first time that I use it, then, If I run it again in the next 600 seconds, I won't be prompted again. Running gpg2 --export-secret-keys --armor [email protected] > /dev/null gives me this: ┌─┐ │ Please enter the passphrase to export the OpenPGP secret key: │ │ "John Doe (asdf) <[email protected]>" │ │ 2048-bit RSA key, ID EB7B49EAD38DE665, │ │ created 2018-10-09. │ │ │ │ │ │ Passphrase: _ │ │ │ │ <OK> <Cancel> │ └─┘ A quick ps aux shows that gpg-agent is running: ps aux | grep gpg-agent jdoe 14089 0.1 0.1 100884 3588 ? SLs 18:50 0:07 /usr/bin/gpg-agent --supervised Alas, running running gpg2 --export-secret-keys... again immediately thereafter prompts me for a password again. A few more details: I'm using pinentry-curses I've got $GPG_TTY exported in my .bashrc gpg2 --version -> gpg (GnuPG) 2.2.4 I've read through Why does gpg ask for password even with gpg-agent? and How can I find out what keys gpg-agent has cached? (like how ssh-add -l shows you cached ssh keys) , but I didn't quite follow.
From the GnuPG 2.2.4 manual, regarding --export-secret-keys (specifically): GnuPG may ask you to enter the passphrase for the key. This is required, because the internal protection method of the secret key is different from the one specified by the OpenPGP protocol.
gpg-agent is running, but I'm always prompted for password
1,497,996,244,000
I'm currently doing a high school project by studying RSA keys for better understanding them theoretically and practically. A part of the project consist of an experiment, and I choose to test and see how big the workload will be for the CPU when generating RSA keys of different length. I would also like to save the time as a data point, if I need to come to an conclusion. The machine is running Ubuntu 16.04 and the applications is downloaded from the default repositories. The plan is to use GnuPG to generate RSA keys of different length (1024, 2048, and 4096) and GNU Time to get the CPU's workload and the time to execute the process. The process will be automated with a python script and will look something like this: For length in [1024, 2048, 4096]: 1.1. For X times: 1.1.1. Execute Gnu PG command and monitor system resources 1.1.2. Write use of system resources to file I will thereafter plot some graphs to see if my hypothesis is correct. But I got some questions regarding the implementation of my GnuPG test. An explanation of how my implementation will come after the questions. My questions are: Does this settings do what I want to do? Can I someway disable the automatic creation of revoke certificates? Why does it take much longer to generate some keys? Why does GnuPG give the answer that the it took 0 CPU-seconds in userspace for the creation of the keys? Is it done in another process? Why does the CPU workload parameter only show a value (0 < CPU) when it took less than a second (wall clock > 1) for creating the keys? Reading the manual it seems that the simplest way to generate the keys is with the --batch option turned on. I've set the options in a file with the following instructions: # Text syntax in this file #%dry-run %echo Generating RSA key... # Don't ask after passphrase %no-protection Key-type: RSA Key-Length: 1024 Name-Real: Real Name Name-Email: [email protected] Expire-Date: 0 # Generate RSA key %commit %echo Done! The command that executes this file has two parts, the Gnu Time part and the GnuPG part. The GNU Time command is looking as follows: $ time --format="Wall clock: %e[s], CPU (userspace): %U[s], CPU (workload): %P%" And the GnuPG command is the following. $ gpg2 --gen-key --homedir=./rsa-keys --batch [filename] The command that I execute in my shell (fish shell if it's important) is the following (GNU Time + GnuPG): $ time --format="Wall clock: %e[s], CPU (userspace): %U[s], CPU (workload): %P%" gpg2 --gen-key --homedir=./rsa-keys --batch [filename] Output from command: Wall clock: 36.83[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 0.04[s], CPU (userspace): 0.00[s], CPU (workload): 8% Wall clock: 4.76[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 72.39[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 57.52[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 84.71[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 63.32[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 51.10[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 47.58[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 64.72[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 0.05[s], CPU (userspace): 0.00[s], CPU (workload): 6% Wall clock: 0.03[s], CPU (userspace): 0.00[s], CPU (workload): 11% Wall clock: 29.62[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 55.02[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 36.08[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 42.92[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 40.41[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 204.36[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 246.42[s], CPU (userspace): 0.00[s], CPU (workload): 0% Wall clock: 51.50[s], CPU (userspace): 0.00[s], CPU (workload): 0%
GnuPG reads from /dev/random, which blocks when not enough entropy is available (which is a debatable behavior). The actual computational effort is rather negligible. You might also observe that the first run/few runs terminate faster, as the entropy pool was still filled with "fresh bits". I recommend running watch cat /proc/sys/kernel/random/entropy_avail in an additional terminal to get an understanding when GnuPG runs into a "low entropy" mode. On current hardware platforms, processes blocked by IO or sleeping will be put into background, so no CPU time will be accounted. $ time --format='Wall clock: %e[s], CPU (userspace): %U[s], CPU (workload): %P%' sleep 5 Wall clock: 5.00[s], CPU (userspace): 0.00[s], CPU (workload): 0% This is also visible when copying some bytes from /dev/random (which might take quite some time, especially in virtual machines): time --format='Wall clock: %e[s], CPU (userspace): %U[s], CPU (workload): %P%' dd if=/dev/random of=/dev/null bs=1 count=512 512+0 records in 512+0 records out 512 bytes copied, 210.672 s, 0.0 kB/s Wall clock: 210.67[s], CPU (userspace): 0.00[s], CPU (workload): 0% Finally, this also explains why the fast iterations hade a much higher CPU workload: as the processes was blocked in IO-wait for a much smaller period of time, the portion of actual computation time of the full execution time is much larger.
Questions regarding generating RSA keys with GnuPG
1,497,996,244,000
Problem I wish encrypt an email to [email protected], using mutt. I have an associated key, which I trust marginally. After attempting to send the email, I have to select from a list of keys, both of which appear identical. -> 1 ? 4096/0x123456789ABCDE01 RSA es 2 ? 4096/0x123456789ABCDE01 RSA es Foo <[email protected]> After selecting either, I am given the prompt: ID has undefined validity. Do you really want to use the key? ([no]/yes): Is there a way to skip these two additional steps? (Also, why are there two identical options?) Troubleshooting Trust If I change the trust settings of the key to "full", I still have the same issue. However, if I change it to "ultimate" then I can skip both prompts. pgp-hook Alternatively, I attempted to put the following in ~/.mutt/muttrc. pgp-hook [email protected] 0x123456789ABCDE01 Now when I attempt to send the email, it's better, but I'm still given one prompt: Use keyID = "0x123456789ABCDE01" for [email protected]? ([yes]/no):
It looks like Dale Woolridge's confirm-crypt-hook patch has been merged into mutt. use crypt-hook rather than pgp-hook. crypt-hook [email protected] 0x123456789ABCDE01 set crypt_confirmhook=no for that recipient. e.g. send-hook ~t [email protected] 'set crypt_confirmhook=no' This should work with mutt or neomutt.
How can I get mutt to automatically select pgp keys?
1,497,996,244,000
When running. sudo apt-get update For example something like this could happen. W: GPG error: http://deb.torproject.org wheezy Release: The following signatures were invalid: KEYEXPIRED 1409325681 KEYEXPIRED 1409325681 KEYEXPIRED 1409325681 KEYEXPIRED 1409325681 (This question is not about this particular example warning. It has already been reported.) Exit code. echo $? 0 Exit code 0 is problematic for automated use in scripts, where success is expected. This is a bug in Debian's apt-get: apt: Provide meaningful exit codes for gpg failures How to notice GPG errors in scripts when the exit code is not reliable?
Make a wrapper script around /usr/bin/gpgv. Supply the pathname to the wrapper script as the value of Dir::Bin::gpg (using apt-get --option). Have the wrapper script examine the output and exit status of gpgv, and communicate failure back to the toplevel script somehow (I suggest using kill to send a signal).
apt-get update: How to check for GPG errors when using scripts?
1,497,996,244,000
I'm running Ubuntu (via Regolith) and my gpg key is unlocked when I log in. I'm running multiple decrypt operations in parallel and I noticed, that if I get above 7, gpg-agent will "forget" that the key is already unlocked and I get prompted for a pinentry. ❯ gpg --version gpg (GnuPG) 2.2.27 libgcrypt 1.10.1 I made a minimal working example to demonstrate this in python. Create a test file to decrypt with: echo "something" | gpg --encrypt -o test.gpg. Running gpg --decrypt test.gpg in the shell does not prompt for the passphrase. Using the below script, if the WORKERNUM is set below 8 (on my machine, but setting it to 1 I guess should work for any machine) the script is happily decrypting without asking for a passphrase. But if I crank it up to 8 or above I start getting requests for putting in my password, although it seems like not from every process, only some of them. The execution of the processes also obviously start to hang (I'm assuming they are waiting on gpg-agent). import subprocess import multiprocessing as mp import time the_queue = mp.Queue() WORKERNUM = 7 def worker_main(queue): while True: msg = queue.get(True) print(time.time(), msg) out = subprocess.run(["gpg", "--decrypt", "test.gpg"], capture_output=True) print(msg, time.time(), out.stdout) the_pool = mp.Pool(WORKERNUM, worker_main, (the_queue,)) counter = 0 while True: counter += 1 the_queue.put(counter) print(the_queue.qsize()) while the_queue.qsize() > 10: time.sleep(0.1) I tried passing --batch to the decrypt command, but that didn't change anything. I've been looking through the man pages for gpg and gpg-agent to see if anything is mentioned that could pertain to this, but I couldn't really find anything. I have two questions: a) why does this happen and b) is there something I can configure so that instead of having to figure out the max size of the processing pool to avoid this, gpg handles this and I don't get a pinentry
After careful monitoring of journalctl I found that the actual error was Cannot allocate memory. Based on this discussion, gpg-agent can run out of secure memory if multiple thread are trying to access it. Setting auto-expand-secmem 100 in ~/.gnupg/gpg-agent.conf resolves the issue. --auto-expand-secmem n Allow Libgcrypt to expand its secure memory area as required. The optional value n is a non-negative integer with a suggested size in bytes of each additionally allocated secure memory area. The value is rounded up to the next 32 KiB; usual C style prefixes are allowed. For an heavy loaded gpg-agent with many concurrent connection this option avoids sign or decrypt errors due to out of secure memory error returns.
gpg-agent "forgetting" password for key, when getting too many requests
1,536,161,877,000
Adding to this question: How do I close gnupg V2.0 smartcard after signing an rpm? I tried to execute: gpg-agent --default-cache-ttl 15 --max-cache-ttl 15 --daemon But after 15 seconds, if I execute again a signature, gpg2 doesn't prompt for the PIN. The only solution I've found so far, is to unplug/plug smartcard on the reader.
Starting gpg-agent with those parameters probably gives you a message: gpg-agent: gpg-agent running and available You are not changing that running session, and that is what caches your PIN. That session is (at least on my Ubuntu 12.04 system) started by the gnome-session, effectively by the script /etc/X11/Xsession.d/90gpg-agent. On my system it doesn't seem that that file allows for any dynamic commandline option setting for gpg-agent, so you might have to hardcode those options in there. You can of course also kill and restart the gpg-agent, that will let you get rid of the cached pins as well. Just make sure the output of the command goes to the file where the original invocation of gpg-agent puts it (on my system ~/.gnupg/gpg-agent-info-<hostname>). At some point my bank's software forced me to take out the smartcard, as a protective measure, after providing my signature/pin. As their software was running on a VirtualMachine, I would just temporarily virtually remove the USB (on which the CardReader was connected) from the host (using a small python script). That would work for you as well if you would be running on a VM.
How close smartcard after sign rpm with GPG2?
1,536,161,877,000
I'm using Gnome Keyring with GPG. Whenever I need to sign something, the keyring daemon takes over and does it for me. However, if I do: export GNUPGHOME=/path/to/keyring from a Bash script and use gpg in that script, the keyring daemon doesn't take over. Why is this? How can I change this, so that the keyring is used for other $GNUPGHOMEs as well? If I run seahorse, I can see that the password for the keys that exists in /path/to/keyring is there.
Solved it! The problem was that the option use-agent wasnt enabled. I had previously uncommented use-agent in ~/.gnupg/gpg.conf to be able to use the keyagent for my default keyring. BUT, since I changed the homedir of the keyring, gpg was looking for a config in /path/to/keyring/gpg.conf instead and found nothing, since I only moved pubring.gpg and secring.gpg when I exported the keyring.
Use non-default keyring with gnome-keyring
1,536,161,877,000
I am using the instructions linked below to setup apt to install sublime-text. I am intentionally applying the method for connecting to third party repositories described on the Debian and Stackexchange pages, using Sublime as an example of a third party repo. https://www.sublimetext.com/docs/linux_repositories.html https://wiki.debian.org/DebianRepository/UseThirdParty How to add a third-party repo. and key in Debian? However, when running apt update I am getting the following error regarding the encryption key: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F57D4F59BD3DF454 This is what I am doing: Download key, convert key from ascii to binary, and move key to shared location: curl https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor > ~/Downloads/sublime-keyring.gpg sudo mkdir -vp /usr/local/share/keyrings/ sudo mv -v ~/Downloads/sublime-keyring.gpg /usr/local/share/keyrings/sublime-keyring.gpg sudo chown -v root:root /usr/local/share/keyrings/sublime-keyring.gpg sudo chmod -v 0640 /usr/local/share/keyrings/sublime-keyring.gpg Create source list: printf "deb [signed-by=/usr/local/share/keyrings/sublime-keyring.gpg] https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list Set pinning rules to restrict repo usage: printf "%s\n" "Package: *" "Pin: origin download.sublimetext.com" "Pin-Priority: 1" "" "Package: sublime-text" "Pin: origin download.sublimetext.com" "Pin-Priority: 500" | sudo tee /etc/apt/preferences.d/sublime-text.pref Then I run sudo apt update which creates the following output regarding sublime text repo: Get:1 https://download.sublimetext.com apt/stable/ InRelease [2.536 B] Err:1 https://download.sublimetext.com apt/stable/ InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F57D4F59BD3DF454 W: GPG error: https://download.sublimetext.com apt/stable/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F57D4F59BD3DF454 E: The repository 'https://download.sublimetext.com apt/stable/ InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. When I run with debug for gpg, sudo apt -o Debug::Acquire::gpgv=True update, I get a few more details: Get:1 https://download.sublimetext.com apt/stable/ InRelease [2.536 B] 0% [Waiting for headers] [Waiting for headers]inside VerifyGetSigners Preparing to exec: /usr/bin/apt-key --quiet --readonly --keyring /usr/local/share/keyrings/sublime-keyring.gpg verify --status-fd 3 /tmp/apt.sig.zwA50y /tmp/apt.data.zbzsmw Read: [GNUPG:] NEWSIG Read: [GNUPG:] ERRSIG F57D4F59BD3DF454 1 8 01 1627009220 9 - Got ERRSIG F57D4F59BD3DF454 ! Read: [GNUPG:] NO_PUBKEY F57D4F59BD3DF454 Got NO_PUBKEY F57D4F59BD3DF454 ! gpgv exited with status 2 Summary: Good: Valid: Bad: Worthless: SoonWorthless: NoPubKey: NO_PUBKEY F57D4F59BD3DF454 Signed-By: NODATA: no Err:1 https://download.sublimetext.com apt/stable/ InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F57D4F59BD3DF454 W: GPG error: https://download.sublimetext.com apt/stable/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F57D4F59BD3DF454 E: The repository 'https://download.sublimetext.com apt/stable/ InRelease' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. I read this to mean that apt is correctly passing on the location of the key I have downloaded. This could mean that gpg can not read the contents of the key. Or maybe the key was somehow mangled in the dearmoring process and no longer has the contents expected. This is pure guessing on my part. When I inspect the dearmored key, sudo gpg --show-keys /usr/local/share/keyrings/sublime-keyring.gpg, I get the following, which seems plausibly correct: pub rsa4096 2017-05-08 [SCEA] 1EDDE2CDFC025D17F6DA9EC0ADAE6AD28A8F901A uid Sublime HQ Pty Ltd <[email protected]> sub rsa4096 2017-05-08 [S] The key is readable, although it does not mention F57D4F59BD3DF454. So what went wrong? How can I get this to function correctly?
I assumed that all processes reading the public key file would have root access. But it turns out likely not to be the case. Because setting the permissions to 0640 caused the issues I reported, and setting them to 0644 instead resolved the problems. The updated command should look as follows: sudo chmod -v 0644 /usr/local/share/keyrings/sublime-keyring.gpg With this change, I was able to update and install Sublime Text using the process described in the question.
Installing Sublime Text with apt fails due to missing public key
1,536,161,877,000
I've lost my key. Now I can't sign anything, and servers don't accept unsigned content. The key is uploaded to a keyserver. Now I have fingerprint, public key and I remember my passphrase. How can I re-generate same key on my Linux box?
You cannot generate the private key¹ from the public key and the passphrase. The private key does not depend on the passphrase in any way. The passphrase is only used to encrypt the private key when you store it in a file. You could have multiple copies of the same private key encrypted with different passphrases. And you cannot recover the private key from the public key, public key cryptography relies on this being impossible. The only way to recover your private key is from a backup of the private key. ¹ Outside of gpg, it's typically called a private key when there's a corresponding public key, and a secret key for symmetric encryption.
Generate GPG secret key from public key and passphrase
1,536,161,877,000
I've used gpg2 to generate some keys on my Ubuntu 16.04 server. Now I have to move the machine. I need to transfer all generated keys to a Mac. I think I just have to copy the ~/.gnupg files. But where do I have to store it to get them called via gpg --list-secret-keys --keyid-format LONG [email protected]? Same place? And how do I install gpg2 on my Mac? homebrew gpg2 is not existing.
On the machine that initially has the keys (the Ubuntu machine): Export the public keys: gpg --export --armor --output=key_public.asc Export the private keys: gpg --export-secret-keys --armor --output=key_secret.asc Copy the exported files to the second machine (the Mac). Import the keys: gpg --import --armor key_public.asc and gpg --import --armor key_secret.asc The above commands will export all the keys in your keyring. If you just want a specific key/s, you need to specify it/them by uid.
How to move my GnuPG home directory from Ubuntu to Mac?
1,536,161,877,000
I have a weird ask. I have a tar achive, archive.tar.gz, filled with plaintext files. That archive is then gpg encrypted into archive.tgz.gpg. In total, archive.tgz.gpg is < 100KB. Now, I want to make archive.tgz.gpg look like a linux binary, and have it be un-obfuscated using mostly unix standard utilities. I'm aware that it's (very likely) not going to work as a binary executable, and that's ok. But at a cursory glance, it should roughly appear as a corrupted binary executable. The furthest I've gotten is trying to modify the header using cat and dd so that file doesn't correctly return the file type, but I haven't gotten very far in finding much information about doing this online. If someone would be able to help point me in the right direction, I'd greatly appreciate it. Thanks!
You can totally embed the payload into a working executable. echo "I am your encrypted message." > message.txt gpg2 --symmetric message.txt ld -r -b binary -o message.o message.txt.gpg gcc -o unsuspicious unsuspicious.c message.o With unsuspicious.c containing any program: #include <stdio.h> int main(int argc, char** argv) { printf("Hi. I am a totally unsuspicious executable.\n"); } With this technique, the payload will end up in the .data section of the binary. To retrieve it, extract the entire data section: objcopy --dump-section .data=data.bin unsuspicious Some other data is preceeding my 104 bytes of payload. I used nm unsuspicious to determine the exact difference between __data_start and _binary_message_txt_gpg_start, in my case 16 bytes. Knowing this, I can retrieve the payload: dd if=data.bin skip=16 bs=1 count=104 of=message.txt.gpg Whether this is a valid implementation for your goal depends on whether you consider nm, objcopy and dd "standard utilities". Of course, you can always add some logic to the program itself so it just prints the payload if asked nicely.
Make GPG encrypted file look like binary executable
1,536,161,877,000
I know that I can create a GPG keypair from the CentOS 7 terminal by typing gpg --gen-key and following the resulting steps, but how can I make sure that the resulting public key is self-signed? And how can I send the resulting key via email to a remote computer? I know that I can send an email with an attachment using mailx from the command line as follows: echo "this is the body of the email" | mailx -s"Subject" -a public.key [email protected] But the mailx code snipped assumes that the key is available in a file. In reality, the key is locked up in a keyring and needs other syntax in order for it to be accessed. EDIT I am following @HaukeLaging's advice. I have created a new key, but when I type gpg --list-sigs in the command line, I get the following results: /home/username/.gnupg/pubring.gpg ----------------------------------------- pub 4096R/CODE1 2015-02-04 uid User Name <[email protected]> sig 3 CODE1 2015-02-04 User Name <[email protected]> sub 4096R/CODE2 2015-02-04 sig CODE1 2015-02-04 User Name <[email protected]> Which of these key codes is the public key? And Which is the private key? I do not want to accidentally send the private key to anyone. EDIT#2 As per @HaukeLaging's response to EDIT#1, I tried: `sudo gpg --armor --export CODE1 >/home/username/my_public_cert.asc` but the result is an empty file when I then cd /home/username/ and ls -al. Also, gpg --list-packets /home/username/my_public_cert.asc resulted in gpg: processing message failed: Unknown system error Why is gpg --armor --export CODE1 >/home/username/my_public_cert.asc producing an empty file?
First, find the public key you want to export: gpg --list-public-keys Look at the line marked 'pub'; it displays your public key type and number. For instance: pub 1024D/5000280F 2009-07-10 Use the number to do your export: gpg --armor --export 5000280F > klaatu_pubkey.asc Check to make sure it worked: cat klaatu_pubkey.asc As long as it's not empty, you can send that file to your friends. Since the PGP model is based on a web of trust, it is beneficial to get your public key out there into the world so people can start using it. The easiest way to do that is to post it to a key server: gpg --export send-keys 5000280F --keyserver keys.fedoraproject.org Key-servers mirror one another periodically, so your key will propagate and people who receive signed emails from you can just download/import your pub key from the network of key servers.
creating and sending a self-signed public key using GnuPG in CentOS 7
1,536,161,877,000
I have encrypted a file through gpg ***.gpg --encrypt --recipient [email protected] *** The hard disk with my Linux system where such file was encrypted has dead. I keep just the ***.gpg file in an external hard drive. When I try in my new Linux system gpg --output *** --decrypt ***.gpg I get gpg: encrypted with RSA key, ID 7522CDC994071949 gpg: decryption failed: No secret key Does this issue have a solution? I tried killing gpg-agent as suggested in some places, without success. Thank you in advance for your help
gpg needs a private key to decypher your file. If you have none (because your disk is wiped), you won't be able to decipher it. In a sense, it is hopefully because on an other way other people would be able to decipher it too. Then when using gpg, your ~/.gnupg directory should be backuped with as many precaution as the enciphered files. You also have the gpg --export > export and gpg --export-secret-keys > export commands to export all yours keys in a pair of files you should backup instead. But these precautions must be done before losing the disk. gpg-agent is only a server which stores the keys in memory and make them available without typing the password twice. But this server needs the ~/.gnupg files for reading your keys the first time you need them. (If it wouldn't, everybody could run this server and decipher your files). The gpg -K prints the available secret keys. Then you can check your configuration.
Solving gpg: decryption failed: No secret key
1,536,161,877,000
Following these instructions, I downloaded and unpacked the kernel. https://priyachalakkal.wordpress.com/2013/01/19/verifying-digital-signature-using-gpg/ Then I tried to verify the signature but I get an unexpected error. That isn't one of the success or failure scenarios described by sites that document the basic approach. Is there a command line flag I need to provide to tell it where to look for the public key? ~# gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 79BE3E4300411886 gpg: /root/.gnupg/trustdb.gpg: trustdb created gpg: key 79BE3E4300411886: public key "Linus Torvalds <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1 ~# gpg --verify linux-5.6.9.tar.sign gpg: assuming signed data in 'linux-5.6.9.tar' gpg: Signature made Fri 01 May 2020 11:51:56 PM PDT gpg: using RSA key 647F28654894E3BD457199BE38DBBDC86092693E gpg: Can't check signature: No public key Update 1: Based on @StephenKitt's answer, I tried to grab the key indicated in the first message (in order to get it to find a user ID I had to specify the key server), but the result was not what was expected: ~# gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 647F28654894E3BD457199BE38DBBDC86092693E gpg: key 38DBBDC86092693E: public key "Greg Kroah-Hartman <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1 ~# gpg --verify linux-5.6.9.tar.sign gpg: assuming signed data in 'linux-5.6.9.tar' gpg: Signature made Fri 01 May 2020 11:51:56 PM PDT gpg: using RSA key 647F28654894E3BD457199BE38DBBDC86092693E gpg: Good signature from "Greg Kroah-Hartman <[email protected]>" [unknown] gpg: aka "Greg Kroah-Hartman <[email protected]>" [unknown] gpg: aka "Greg Kroah-Hartman (Linux kernel stable release signing key) <[email protected]>" [unknown] gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 647F 2865 4894 E3BD 4571 99BE 38DB BDC8 6092 693E Update 2: With some googling I was able to figure out what to do about the non-trusted signature warning (see comment/reply to Stephen in the respective answer) ~# gpg2 --tofu-policy good 647F28654894E3BD457199BE38DBBDC86092693E gpg: Setting TOFU trust policy for new binding <key: 647F28654894E3BD457199BE38DBBDC86092693E, user id: Greg Kroah-Hartman <[email protected]>> to good. gpg: Setting TOFU trust policy for new binding <key: 647F28654894E3BD457199BE38DBBDC86092693E, user id: Greg Kroah-Hartman <[email protected]>> to good. gpg: Setting TOFU trust policy for new binding <key: 647F28654894E3BD457199BE38DBBDC86092693E, user id: Greg Kroah-Hartman (Linux kernel stable release signing key) <[email protected]>> to good. ~# gpg2 --trust-model tofu --verify linux-5.6.9.tar.sign gpg: assuming signed data in 'linux-5.6.9.tar' gpg: Signature made Fri 01 May 2020 11:51:56 PM PDT gpg: using RSA key 647F28654894E3BD457199BE38DBBDC86092693E gpg: Good signature from "Greg Kroah-Hartman <[email protected]>" [full] gpg: aka "Greg Kroah-Hartman <[email protected]>" [full] gpg: aka "Greg Kroah-Hartman (Linux kernel stable release signing key) <[email protected]>" [full] gpg: [email protected]: Verified 1 signatures in the past 0 seconds. Encrypted 0 messages. gpg: [email protected]: Verified 1 signatures in the past 0 seconds. Encrypted 0 messages. gpg: [email protected]: Verified 1 signatures in the past 0 seconds. Encrypted 0 messages.
You don’t have the right key; the 5.6.9 archive is signed by Greg Kroah-Hartman, not Linus. Running gpg --recv-keys 647F28654894E3BD457199BE38DBBDC86092693E will allow you to verify the archive. (This is the fingerprint from your second gpg invocation.) The message you get after retrieving the key indicates two things: the archive’s signature is good (“Good signature from” ...); but you have no proof that the key you downloaded really is Greg’s. Basically, this means that you can trust the archive, as long as you trust the key. GPG maintains a trust database, which tracks links from your key to others; most people (including you) don’t have any. This is based on the web of trust, and is considered impractical as a general-purpose tool; in most cases, “trust on first use” (TOFU) is simpler and just as useful. You can change the trust model with the --trust-model option; see the GnuPG manual for details (and discussion).
Trouble verifying linux, even after downloading key I get "No public key"
1,536,161,877,000
I would like to speed up my archiving operations, I am usually doing 23 GiB (one Blu-Ray) backups. I have found this: How to do large file parallel encryption using GnuPG and GNU parallel? Since I don't understand this code at all (have never used parallel): tar --create --format=posix --preserve-permissions --same-owner --directory $BASE/$name --to-stdout . | parallel --pipe --recend '' --keep-order --block-size 128M "xz -9 --check=sha256 | gpg --encrypt --recipient $RECIPIENT;echo bLoCk EnD" | pv > $TARGET/$FILENAME I would like to ask if anyone could kindly parse it for me. Thank you.
tar run command tar. --create create a tar archive. --format=posix use the POSIX format of tar archive. This means you can extract it on other systems that support the POSIX format. --preserve-permissions keep the same permissions on the files --same-owner keep the same owner of the file (only relevant when extracting as root) --directory $BASE/$name change to the dir $BASE/$name before starting --to-stdout instead of saving to a file, send output to stdout . tar the whole directory | pipe stdout to next command parallel run parallel --pipe use pipe mode, so input on stdin will be given as input on stdin to the command to run (and not as command line arguments, which is the normal mode). --recend '' Normally GNU Parallel splits on \n. Disable that because input is not text, but binary data. --keep-order Make sure the output of the first command run is printed before the output of the second command - even if the second command finishes first. --block-size 128M Pass a block of 128 MB of data to the command. "..." the command to run | pipe stdout to next command pv show the speed of which data is sent > $TARGET/$FILENAME redirect stdout to $TARGET/$FILENAME GNU Parallel starts this command for each 128MB block: xz the command xz -9 compress level 9 --check=sha256 include integrity check in the output to be able to catch bit errors (e.g. on faulty disks). | pipe stdout to next command gpg the GNU Privacy Guard command --encrypt encrypt data coming on stdin --recipient $RECIPIENT use $RECIPIENT's key for encryption ; command separator echo bLoCk EnD print bLoCk EnD
GNU parallel proper usage in conjunction with tar, xz, gpg
1,536,161,877,000
From what I understand it is considered to be good practice to generate a private-public keypair, generate a subkey for encrypting, export all three keys and store/backup them (e.g. using 'paperkey') and then only re-import the public key and the subkey (see https://paul.fawkesley.com/gpg-for-humans-protecting-your-primary-key/ as well as https://riseup.net/en/security/message-security/openpgp/best-practices#only-use-your-primary-key-for-certification-and-possibly-signing-have-a-separate-subkey-for-encryption). In addition keys should have an expiration date (see https://riseup.net/en/security/message-security/openpgp/best-practices#use-an-expiration-date-less-than-two-years). To update the expiration date, I currently perform the following steps manually: gpg --import /PATH/TO/FULL-PRIVATE-KEY.asc gpg --edit-key BADC0FFE0DDF00D > expire # the main key > 1y # expire in 1 year > key 1 # select the first subkey > key 2 # select the second subkey in addition > expire # for both of the subkeys > y # perform action on both keys > 1y # expire in 1 year > save Now I want to delete the imported private main key again. Currently I know of two methods to do that: either gpg -K BADC0FFE0DDF00D # here I should see the key gpg --delete-secret-and-public-keys BADC0FFE0DDF00D gpg -K BADC0FFE0DDF00D # now nothing should be visible gpg --import /PATH/TO/PRIVATE-SUB-KEY.asc /PATH/TO/PUBLIC-KEY.pub or gpg -K --with-keygrip BADC0FFE0DDF00D # copy the keygrip and use it below rm -i ~/.gnupg/private-keys-v1.d/8BADF00DBEEFCACEDEFEC8EDDEADFA11.key I dislike both methods: the first one has many steps and requires me to export and then import the (public and sub-)key files, the second one feels kind-of easy-to-get-wrong (you don't get asked for confirmation (ignoring the 'rm -i'), e.g. if that is the correct secret key you are deleting). Isn't there anything more elegant I could do, like gpg --delete-only-the-private-signing-key-if-you-have-already-created-other-subkeys BADC0FFE0DDF00D or something similar? I'd appreciate any ideas! I'm using Debian Stable (actually PureOS amber, which is based on Debian Stable) and gpg (GnuPG) 2.2.12
To change the expiration date, I would suggest to use gpg --quick-set-expire FINGERPRINT \* which is easier to script.  See the man page (here or here) for details. For deleting just the primary secret key you can use a regular command; for example: $ gpg --delete-secret-key 502D1A5365D1C0CAA69945390BA52DF0BAA59D9C\! sec nistp256/0BA52DF0BAA59D9C 2010-09-17 ec_dsa_dh_256 <[email protected]> Note: Only the secret part of the shown primary key will be deleted. Delete this key from the keyring? (y/N) y This is a secret key! - really delete? (y/N) y Note the exclamation mark at the end of the fingerprint – it forces the use of a specific primary or subkey so that the command does not work on the entire key. The exclamation mark is quoted due to shell requirements. To avoid the confirmation prompts, add --batch and --yes. Take care: your version 2.2.12 does not work correctly; we fixed this with 2.2.16 – so better update to the latest version (2.2.21 released in the beginning of July 2020). Disclosure: I received this answer from Werner Koch @ dev.gnupg.org  in the gnupg.org-forum and wanted to share it here as well.
Delete only private signing key from within gpg (without reimporting subkeys or 'rm ~/.gnupg/private-keys-v1.d/KEYGRIP.key')
1,536,161,877,000
I often use gpg command to encrypt files like so gpg -c file which produces a file.gpg. I would like to get rid of the command line aspect and have a right click button in my Nautilus. I tried installing the Seahorse extension for Nautilus but it doesn't work very well and I would like to keep the simplicity of my above command. How should I do?
As far as I know there are two simple ways to add entries to the Nautilus context menu : Nautilus scripts nautilus-actions package, which, depending on your distribution might be depreciated. I'm running on Debian Bullseye/sid where nautilus-actions is not available so I will present the way using Nautilus script. To learn more about this Nautilus functionality you can spend a little time on the Ubuntu side of StackExchange, guys talk a lot about Nautilus scripts down there. Basically, this feature allows you to add context menu entries to Bash (or Python for example) scripts located in your ~/.local/share/nautilus/scripts/ directory. Using two scripts What I propose is to implement two scripts: one to encrypt, one to decrypt. Your contextual menu will look as follows when right-clicking on a file : Encrypt script The encrypt script would simply be #!/usr/bin/env bash # Encrypt # gpg-encrypt Nautilus script gpg -c --no-symkey-cache "$1" && rm -f "$1" where the first Bash argument $1 is the file path selected by Nautilus when right-clicking. The --no-symkey-cache prevents gpg from keeping the passphrase in cache. By default the passphrase is stored for a certain amount of time after encrypting and decrypting a file, I personally don't like this feature so I use this option. I also added && rm -f "$1" in order to remove the original file after encryption, you can remove that if you don't want it. Decrypt script The decrypt script would be #!/usr/bin/env bash # Decrypt # gpg-decrypt Nautilus script ext=`echo "$1" | grep [.]gpg` if [ "$ext" != "" ]; then gpg --batch --yes --no-symkey-cache "$1" else zenity --error --text "The selected file is not crypted." fi Let me explain what the script does. It uses a variable ext which is empty when the selected file is not a .gpg file and which is not empty if the selected file is a .gpg file. If the selected file is an encrypted .gpg file, the script will use the gpg command to decrypt it. I passed the options --batch --yes in order to overwrite if the output file already exists. For example decryption of file.gpg will overwrite file if it exists. If you don't want to overwrite, I suggest you use the output gpg's option and zenity --file-selection to specify the decrypted file name. If the selected file is not an encrypted .gpg file, the script will use zenity --error to pop-up an error window. This script test whether the file is encrypted by looking through the extension. A better way to do that would be to check the MIME type of the selected file. The MIME type of the encrypted file can be found using $ > file $ file -b --mime-type file.gpg application/octet-stream Since application/octet-stream refers to a general binary file and not necessary to an encrypted file I don't think that this approach would be better than checking on the file extension. On the other hand I know that Nautilus maps my gpg-encrypted files to the application/pgp-encrypted MIME type. Maybe someone knows how to get this MIME type from a .gpg file using something else than the file command, in that case it would be relevant. Using two files If you don't want to use two right-click menu entries you can use one single script : #!/usr/bin/env bash # Encrypt-Decrypt # gpg-encrypt/decrypt Nautilus script ext=`echo "$1" | grep [.]gpg` if [ "$ext" != "" ]; then gpg --batch --yes --no-symkey-cache "$1" else gpg -c --no-symkey-cache "$1" && rm -f "$1" fi This script will decrypt if the selected file is a .gpg file and encrypt if the selected file is every else. Decrypt with double click in Nautilus Additionally you can allow Nautilus to decrypt encrypted .gpg when double-clicking by adding the following desktop entry into your ~/.local/share/applications/ directory. # Decrypt.desktop [Desktop Entry] Name=GPG Decrypt Terminal=false Type=Application MimeType=application/pgp-encrypted; Exec=gpg --batch --yes --no-symkey-cache %F NoDisplay=true If no other application is used by default, double-clicking in Nautilus will now decrypt the file. Seahorse might be selected as default application if you're using default GNOME, in that case you have to select GPG Decrypt in Open With Other Application Menu. Installation This little Bash script will install everything in the right location for you : chmod +x 'Encrypt' 'Decrypt' # script files must be executable! cp Encrypt Decrypt ~/.local/share/nautilus/scripts/ cp Decrypt.desktop ~/.local/share/applications/ update-desktop-database ~/.local/share/applications/ nautilus -q nautilus Demo PS: Tested on GNOME 3.34.2 and gpg 2.2.17 (you can check that with $ gpg --version).
GPG encryption in Nautilus right click menu
1,536,161,877,000
I am unable to install gpg with pip: # pip install gpg Collecting gpg Downloading Complete output from command python setup.py egg_info: Could not find gpgme-config. Please install the libgpgme development package. ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-QzenGe/gpg/ Trying to install libgpgme or libgpgme-dev leads to # pip install libgpgme Collecting libgpgme Could not find a version that satisfies the requirement libgpgme (from versions: ) No matching distribution found for libgpgme How can I install gpg despite the fact that there is no version for my distribution? PS: I am running on Kali 4.6.0: # uname -a Linux hostname 4.6.0-kali1-amd64 #1 SMP Debian 4.6.4-1kali1 (2016-07-21) x86_64 GNU/Linux
Since you need gpgme-config, you’ll need to install libgpgme-dev, which is the development package for libgpgme: apt install libgpgme-dev You could also skip using pip entirely and install the python-gpg (or python3-gpg if you’re using Python 3) package instead: apt install python-gpg
Cannot install python gpg on Kali
1,536,161,877,000
I encrypted it with the command gpg2 -c --passphrase thePassword --batch --no-tty <file >file.gpg2 How can I decrypt it, knowing the password?
I've just tested and it works. On first virtual machine: [yurij@centos7 gpg]$ cat test2.c Another test. Really? OK. [yurij@centos7 gpg]$ gpg2 -c --passphrase password --batch --no-tty < test2.c >test2.c.gpg2 [yurij@centos7 gpg]$ cat test2.c.gpg2 �c�a����0Li�p��t���JL��( �ޢ� Xt��Z�f��(s�XU�K(ؖ��n�O[yurij@centos7 gpg]$ [yurij@centos7 gpg]$ scp test2.c.gpg2 192.168.56.4:trash/gpg [email protected]'s password: test2.c.gpg2 100% 65 57.6KB/s 00:00 On the second virtual machine: yurij@debian9:~/trash/gpg$ cat test2.c.gpg2 �c�a����0Li�p��t���JL��( �ޢ� Xt��Z�f��(s�XU�K(ؖ��n�Oyurij@debian9:~/trash/gpg$ yurij@debian9:~/trash/gpg$ gpg -d --passphrase password --batch --no-tty < test2.c.gpg2 >test2.c.decrypted gpg: CAST5 encrypted data gpg: encrypted with 1 passphrase gpg: WARNING: message was not integrity protected yurij@debian9:~/trash/gpg$ cat test2.c.decrypted Another test. Really? OK.
How to decrypt symmetrically encoded gpg2 files?
1,536,161,877,000
Using a Debian9 server, behind a proxy, I need to install a docker client. So to get a key I use the commands: apt-key adv --keyserver http://WHATEVERKEYSERVERITRY --keyserver-options http-proxy="http://proxy.myclientdomain:4128" --recv-keys 7EA0A9C3F273FCD8 Executing: tmpapt-key-gpghome.BO0J96KdNM/gpg.1.sh --keyserver http://WHATEVERKEYSERVERITRY --keyserver-options http-proxy=http://proxy.myclientdomain:4128 --recv-keys 7EA0A9C3F273FCD8 gpg: keyserver receive failed: no key server available I tryied all keyring/MIT/debian etc... keyservers I know (about 5/6) The proxy is not the cause, apt-update , ping to www.google.com & so on ... are just OK. I think there is another root cause somewhere else... but it is not possible, really not, neither to change anything neither get infrastructure information. So the question is: is there another method to get the key 7EA0A9C3F273FCD8 100% online, generating a file I can then copy/paste?
If all else fails, you can use curl "https://pgp.surfnet.nl/pks/lookup?op=get&search=0x7EA0A9C3F273FCD8" and extract the public key block from the output, for example curl "https://pgp.surfnet.nl/pks/lookup?op=get&search=0x7EA0A9C3F273FCD8" | awk '/^-----BEGIN/ { output = 1 }; output; /^-----END/ { output = 0 }'
apt key management failure any full online solution or key download method
1,536,161,877,000
I'm now using Debian for developing a C++ application with GPGME. Currently I read that a new version of GnuPG (2.1.10) is available which supports ECC. I would really like to use this feature in my application. But as I checked the currently installed version in my system I noticed that I only have GnuPG 1.4.18 available. That raised two questions: How can I replace the stable with the modern version of GnuPG? Will Gpgme automatically use this new version or is there something I have to consider first?
GnuPG Branches There are different release branches of GnuPG, modern, stable and classic. Three different versions of GnuPG are actively maintained: GnuPG "modern" (2.1) is the latest development with a lot of new features. This announcement is about the first release of this version. GnuPG "stable" (2.0) is the current stable version for general use. This is what most users are currently using. GnuPG "classic" (1.4) is the old standalone version which is most suitable for older or embedded platforms. GnuPG Classic and Stable GnuPG 1.4, Classic is based on the old monolithic core and will still be patched for some time, but will not receive new features and algorithms. In Debian (and derivatives), it's available as the gnupg package and gpg binary. GnuPG 2.0 is the current stable release. The Debian package name for it is gnupg2, the binary is installed as gpg2. GnuPG Modern GnuPG 2.1 called modern is more the "experimental" release, with features to be tested in practice, and other applications relying on GnuPG do be fitted to it. It is available for Debian, but as of 2016-01-07 not in the stable repositories, only in Debian Sid (unstable). See "How to install some packages from "unstable" Debian on a computer running "stable" Debian?" on how to install packages from a different release branch, but be aware of the caveats. I'm successfully running GnuPG 2.1 for quite some time now from Unstable/Sid, while having the Debian testing branch installed. Be aware ECC cryptography in OpenPGP is not yet widely spread and supported, so you might have compatibility issues when communicating with others. If you want to use ECC curves, anyway, remember to use the --expert flag to be able to create ECC keys. Roadmap In a lecture at 32C3, GnuPG maintainer Werner Koch announced GnuPG 2.2 will probably be released (rather soon) this year and inherit GnuPG 2.0's stable status, which will probably also result in being included in Debian Testing rather soon, maybe already for Debian 9. Sadly, there's nothing I can cite, the lecture was neither recorded nor are the slides available. GPGME The Debian package libgpgme11 requires GnuPG 2 which is also fulfilled when using GnuPG 2.1. Applications using GPGME should automatically pick up GnuPG 2.1 when available instead of GnuPG 2.0 (and you can't have both through Debian's package manager, anyway).
How to replace GnuPG stable with GnuPG modern?
1,536,161,877,000
On OpenBSD, how/with what I can create an encrypted container that can later be dynamically expanded? Can I do it with GPG? (password protection is enough) So, if I open this container and put files in it, it would dynamically expand as more files are put in it. Please do not recommend a Linux solution (e.g. TrueCrypt) without checking that it works on OpenBSD.
The official encrypted container on OpenBSD is through vnode pseudo devices, set up with vnconfig. As far as I know, these cannot be resized: you'd have to create another, larger container and copy the data. Encfs is a FUSE flesystem that performs encryption file by file (so there is no container size issue). There is a FreeBSD port, which I think could easily be adapted to OpenBSD. An alternative approach is to use gpg. You can edit the file in an editor such as Emacs or Vim that automatically decrypts and encrypts the file on the fly. But if you want to use the file in some other application, you'll have to encrypt and decrypt manually.
How to create an encrypted container (dynamically expandable) on OpenBSD
1,536,161,877,000
First, I have done literally hours of work and research on this... attempting to find a solution my self. But I am unable to either understand what I am missing or get all the info I need (not sure which). Second, this is the first time I have ever dealt with GPG. Lastly, I am aware just how old the version of Zabbix am trying to get is. I am setting up a server and want to monitor some items using Zabbix (sender only). I am trying to "properly" add Zabbix as a repo so I can install the "zabbix-sender" using apt-get. Below is (to the best of my ability) everything I have tried / learned on how this is done. Going to skip to where I am instead of explaining where I started (not knowing anything). Get public key wget https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4 Import key gpg --import RPM-GPG-KEY-ZABBIX-79EA5ED4 Sign key gpg --lsign-key 79EA5ED4 Trust key gpg --edit-key 79EA5ED4 trust 4 quit Put repo key in key ring curl -fsSL https://repo.zabbix.com/zabbix/2.4/debian/dists/jessie/Release.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/zabbix.gpg Add repo to sources list echo deb [signed-by=/etc/apt/keyrings/zabbix.gpg] http://repo.zabbix.com/zabbix/2.4/debian jessie main | sudo tee /etc/apt/sources.list.d/zabbix.list Update repos apt-get update Result Err:1 http://repo.zabbix.com/zabbix/2.4/debian jessie InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D13D58E479EA5ED4 Reading package lists... Done W: GPG error: http://repo.zabbix.com/zabbix/2.4/debian jessie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D13D58E479EA5ED4 Result of gpg --list-keys gpg: checking the trustdb gpg: marginals needed: 3 completes needed: 1 trust model: pgp gpg: depth: 0 valid: 1 signed: 1 trust: 0-, 0q, 0n, 0m, 0f, 1u gpg: depth: 1 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 1f, 0u gpg: next trustdb check due at 2026-05-03 /root/.gnupg/pubring.kbx ------------------------ pub rsa3072 2024-05-03 [SC] [expires: 2026-05-03] REDACTED for security uid [ultimate] REDACTED for security (this is my key) sub rsa3072 2024-05-03 [E] [expires: 2026-05-03] pub dsa1024 2012-10-28 [SC] FBABD5FB20255ECAB22EE194D13D58E479EA5ED4 uid [ full ] Zabbix SIA <[email protected]> sub elg1024 2012-10-28 [E] What am I doing wrong?
I tried your suggestion Stephen. Unfortunately, that resulted in the same error. I asked someone I know about this... He pointed out that the GPG key that I am getting is expired... I believe that may be the actual cause. I was confused by the wording of the error "the public key is not available". This led me to believe that apt could not find my imported key. I believe now that what this actually means is that it could not find a valid key for it. I am giving up on getting this specific version. I am hoping that the current version of zabbix-sender has not changed enough to make it so that I will be unable to use it to report to the server I intend to (an old server set up by my boss).
add repo to debian (gpg issue)
1,536,161,877,000
I can decrypt file on one machine, but on another one it says "can't check signature" (but still decrypts file). $ sudo gpg --lock-never -o update.tar -r [email protected] --decrypt myfile.sig gpg: Signature made <DATETIME> gpg: using RSA key <KEY> gpg: Can't check signature: No public key How can I find public key on a machine where it works? Decryption works, i.e. I am seeing update.tar and it is not corrupted. The only problem only is error message about signature check. On one machine I have it and on another I don't. I.e. another machine has public key to check signature somewhere. How to find it?
You may need to reimport/export your keys and import them: run this in a file, make sure you run chmod +x file first. #!/bin/bash your_id_here="$@" #your_id_here is your ID.: #Export keys and ownertrust: exportkey() { gpg --export --armor $your_id_here > $your_id_here.pub.asc gpg --export-secret-keys --armor $your_id_here > $your_id_here.priv.asc gpg --export-secret-subkeys --armor $your_id_here > $your_id_here.sub_priv.asc gpg --export-ownertrust > $your_id_here.ownertrust.txt } exportkey Run as ./file id on the commandline, or modify this as you will. To make it easier to move around, run this in a folder and then tar it. To import them: #!/bin/bash your_id_here="$@" importkey() { gpg --import $your_id_here.pub.asc gpg --import $your_id_here.priv.asc gpg --import $your_id_here.sub_priv.asc gpg --import-ownertrust $your_id_here.ownertrust.txt } importkey Same thing as above ./file2 id. Of course, do untar them first before running this. PS: It will obviously prompt you for your password, which you usually have when it come to gpg. Just bear in mind it might ask you for your password more than once (think 2 times) because of the two priv key, the rest won't ask for it i believe (unless of course you have the cache setting set in the gpg-agent.conf, in which case it will ask either once or none). Lastly, this only work as a per-id cases. So you'd have to list the ids of your keys yourself by using gpg -k then copy pasting the id that you'd want to backup...
gpg: Can't check signature: No public key
1,536,161,877,000
Every day when I have a scheduled backup running, I see this error: Error processing remote manifest (duplicity-inc.20190724T191929Z.to.20190726T191408Z.manifest.gpg): GPG Failed, see log below: ===== Begin GnuPG log ===== gpg: WARNING: "--no-use-agent" is an obsolete option - it has no effect gpg: AES encrypted data gpg: encrypted with 1 passphrase gpg: decryption failed: Bad session key ===== End GnuPG log ===== How can I resolve this?
just remembered. most likely a gpg upgrade issue, see https://askubuntu.com/questions/1057627/duplicity-fails-with-bad-session-key-error quoting from linked workaround in the above ticket " The problem is, like the linked post stated, that gpg 2.1 retires passphrase from pipe for key auth. The gpg agents needs to be enabled and configured for the restore to work. Add the following to ~/.gnupg/gpg.conf: use-agent pinentry-mode loopback And to your ~/.gnupg/gpg-agent.conf: allow-loopback-pinentry " ..ede/duply.net
How can I fix this gpg error with Backup (deja-dup, duplicity)?
1,536,161,877,000
I encrypted a text file in terminal using "gpg -c filename" and got "filename.txt.gpg" created in my file manager. I deleted the original unencrypted file. Now I want to decrypt it in Nano so I can continue working on it. If, in a terminal, I do "gpg -d filename.txt.gpg", the file opens in terminal where I can read it, but do nothing else. I want to open the encrypted file in Nano, and add data to the file in Nano. I've tried every way I can think of, but not able to decrypt and open the file in Nano. Any ideas? Thx.
gpg -d just prints the file to standard output, but you can redirect the output to a file instead: gpg -d filename.txt.gpg > filename.txt. Or use the -o outputfilename option. Also, you can just run gpg filename.txt.gpg, which cause gpg to guess what you want, and in that case it decrypts the file to filename.txt (dropping the final .gpg). Of course, note that when you decrypt the file on a regular filesystem, the OS may write it to the disk and removing the file afterwards will not clear remains of the file data from the disk. To avoid that, make sure to decrypt sensitive data only to RAM based filesystems. On Linux, that would be the tmpfs filesystem. In some distributions, /tmp is a tmpfs by default. If it isn't, you can mount a new tmpfs simply with mkdir /ramfs; mount -t tmpfs tmpfs /ramfs (as root, change the ownership and permissions as required). Just mounting a filesystem doesn't mean that your files would be saved there, but a full discussion of safely handling sensitive data is outside the scope of this answer.
How decrypt a file in nano text editor?
1,536,161,877,000
System: Linux Mint 19 Cinnamon, based on Ubuntu 18.04. In this answer, I am being pointed at a different solution, other than installing directly from source. Since I haven't ever used dget, I must have it installed first with: $ sudo apt-get install devscripts Upon the first suggested line: $ dget -x http://deb.debian.org/debian/pool/main/r/redshift/redshift_1.12-2.dsc I originally got Validation FAILED!!, which I quickly overcame with creating the following file: ~/.devscripts with contents: DSCVERIFY_KEYRINGS="/etc/apt/trusted.gpg:~/.gnupg/pubring.kbx" as pointed out, slightly changed by me, in this AskUbuntu answer. And simultaneously importing the public key with: $ gpg --keyserver hkp://keys.gnupg.net --recv-keys 402543B2D98854007F627D36A63A58A3F2E17569 I get a warning: dpkg-source: warning: failed to verify signature on ./redshift_1.12-2.dsc The whole command output follows: dget: retrieving http://deb.debian.org/debian/pool/main/r/redshift/redshift_1.12-2.dsc % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 328 100 328 0 0 2466 0 --:--:-- --:--:-- --:--:-- 2466 100 2180 100 2180 0 0 8549 0 --:--:-- --:--:-- --:--:-- 8549 dget: retrieving http://deb.debian.org/debian/pool/main/r/redshift/redshift_1.12.orig.tar.xz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 334 100 334 0 0 865 0 --:--:-- --:--:-- --:--:-- 865 100 474k 100 474k 0 0 666k 0 --:--:-- --:--:-- --:--:-- 2597k dget: retrieving http://deb.debian.org/debian/pool/main/r/redshift/redshift_1.12-2.debian.tar.xz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 338 100 338 0 0 840 0 --:--:-- --:--:-- --:--:-- 840 100 5720 100 5720 0 0 11793 0 --:--:-- --:--:-- --:--:-- 11793 redshift_1.12-2.dsc: Good signature found validating redshift_1.12.orig.tar.xz validating redshift_1.12-2.debian.tar.xz All files validated successfully. gpgv: Signature made Tue 02 Oct 2018 12:40:08 PM CEST gpgv: using RSA key 402543B2D98854007F627D36A63A58A3F2E17569 gpgv: Can't check signature: No public key dpkg-source: warning: failed to verify signature on ./redshift_1.12-2.dsc dpkg-source: info: extracting redshift in redshift-1.12 dpkg-source: info: unpacking redshift_1.12.orig.tar.xz dpkg-source: info: unpacking redshift_1.12-2.debian.tar.xz At this point, I am out of ideas where the warning is coming from? And how to fix it?
I am unsure if this is the right solution to my problem, but since it resolved the warning, I will add it here: sudo apt-get install debian-keyring As pointed out by Stephen Kitt, there is another possibility to disable verification with: dget -x -u ... but the above approach is better from the security standpoint.
dpkg-source: warning: failed to verify signature
1,536,161,877,000
I was was using gpg --gen-key till I got to enter the passphrase where I get: ┌──────────────────────────────────────────────────────┐ │ Please enter Passphrase, │ │ │ │ Passphrase: ________________________________________ │ │ │ │ <OK> <Cancel> │ └──────────────────────────────────────────────────────┘ After some digging I found out this came from gpg-agent which in turn uses pinentry. All I can do here is enter passphrase (which works fine) and press tab, which makes the blinking cursor disappear. But how to I select <ok> or <cancel> in pinentry? gpg was installed on osx via brew When I try CTL+C I get: gpg: signal Interrupt caught ... exiting but can still continue typing a passphrase.
With the cursor in the PIN entry area, pressing Enter will activate the “OK” button. Pressing Tab will highlight the “OK” button and then the “Cancel” button; pressing Enter with a button hightlighted will activate that button.
how to navigate with pinentry
1,536,161,877,000
I don't want to use the standard gpg version in raspbian which is almost 4 years old . I had to compile all the libraries manually . This worked fine but then when I compiled gpg it saied " libgcrypt too old need 1.7.0 have 1.6.4 " even tho I install libgcrypt 1.8.1 . So i uninstalled gpg and libgcrypt with " make uninstall " and compiled them again . With no success . I've tried to find a solution the last two days . There were some forum posts on the ubuntu forums , but they were not very helpful . When I compild it the last time it gave out an error : collect2: error: ld returned 1 exit status Makefile:949: recipe for target 't-stringhelp' failed make[3]: *** [t-stringhelp] Error 1 make[3]: Leaving directory '/home/pi/gnupg-2.2.1/common' Makefile:816: recipe for target 'all' failed make[2]: *** [all] Error 2 make[2]: Leaving directory '/home/pi/gnupg-2.2.1/common' Makefile:590: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/pi/gnupg-2.2.1' Makefile:509: recipe for target 'all' failed make: *** [all] Error 2
Converting comment to answer: From your comments, you are using the oldstable version of Raspbian. You should be aware that the oldstable receives less frequent updates and is estimated to remain within the Debian security team's perview for about one year after the release of the next stable release. See Debian's wiki on oldstable As such, Debian oldstable shouldn't be used unless there is some special reason for it to remain in use. All Raspbian users should change their sources.list to reflect the release of the new stable version of Raspbian which is currently, Stretch GNUPG 2.2 series is also the new stable for GNUPG. The 2.1 series and prior end support at the end of Dec 2017. See GNUPG 2.2.0 Announcement The GnuPG team is pleased to announce the availability of a new release of GnuPG: version 2.2.0. See below for a list of new features and bug fixes. This release marks the start of a new long term support series to replace the 2.0.x series which will reach end-of-life on 2017-12-31. And GNUPG 2.2.1 Announcement We are is pleased to announce the availability of a new GnuPG release: version 2.2.1. This is a maintenance release; see below for a list of fixed bugs. As far as the question: "Will upgrading to Stretch break things?" I would suggest getting a second SD card, installing the new stable version of Raspbian on that new card, and copying over any personal applications and data. This will allow you to test the new stable version while not disturbing your oldstable installation. Addendum Of course, this answer doesn't directly answer your question of "How do I build GNUPG?" For a nice easy to follow answer to this question you can follow the instructions included on GNUPG's Webkey installation page: GNUPG Webkey with local build of new version GNUPG GNUPG Says: The easiest way to install the latest GnuPG version is to use Speedo, which downloads, verifies and builds all dependent packages. To do this first unpack the tarball: $ tar xjf gnupg-2.1.15.tar.bz2 On non GNU system you may need to use this instead: $ zcat gnupg-2.1.15.tar.bz2 | tar xf - Then run: $ make -f gnupg-2.1.15/build-aux/speedo.mk INSTALL_PREFIX=. \ speedo_pkg_gnupg_configure='--enable-gpg2-is-gpg \ --disable-g13 --enable-wks-tools' native If you run into errors you are probably missing some development tools; install them and try again. If all succeeds you will notice a bunch of new directories below webkey's home directory: PLAY bin include lib libexec sbin share swdb.lst swdb.lst.sig Optionally you may delete what is not anymore required: $ rm -rf PLAY include lib swdb.* To make use of your new GnuPG installation you need to run this first (you should add it to webkey's .profile or .bashrc): PATH="$HOME/bin:$PATH" LD_LIBRARY_PATH="$(pwd)/lib" export LD_LIBRARY_PATH End build instructions Of course, you will be playing with the latest version of GNUPG which is no longer 2.1.15
I have trouble installing gnupg on raspberry pi
1,536,161,877,000
How do I make a signed RPM package for my binary? I need to distribute my binary as a signed RPM package on RHEL 4 using GPG. It's for distribution of my binary with YUM ( http://yum.baseurl.org ).
I've used these steps in the past to sign my RPMs. It's pretty much derived from this tutorial, titled: Signing RPMs with your own key. generate a key $ gpg --gen-key gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the file COPYING for details. Please select what kind of key you want: (1) DSA and Elgamal (default) (2) DSA (sign only) (5) RSA (sign only) Your selection? 1 DSA keypair will have 1024 bits. ELG-E keys may be between 1024 and 4096 bits long. What keysize do you want? (2048) Requested keysize is 2048 bits Please specify how long the key should be valid. 0 = key does not expire = key expires in n days w = key expires in n weeks m = key expires in n months y = key expires in n years Key is valid for? (0) 0 Key does not expire at all Is this correct? (y/N) y You need a user ID to identify your key; the software constructs the user ID from the Real Name, Comment and Email Address in this form: "Heinrich Heine (Der Dichter) " Real name: Repository Owner Email address: [email protected] Comment: You selected this USER-ID: "Repository Owner " Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o You need a Passphrase to protect your secret key. We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. +++++.+++++++++++++++++++++++++..+++++...+++++++++++++++....++++++++++++++++++++....++++++++++++++++++++++++++++++..+++++..+++++++++++++++.++++++++++.+++++.........+++++ We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. +++++++++++++++++++++++++++++++++++++++++++++....+++++...+++++.+++++++++++++++..++++++++++++++++++++++++++++++.+++++++++++++++....+++++..+++++...+++++++++++++++..+++++>++++++++++>+++++>+++++.............<+++++....>.+++++..............+++++^^^ gpg: key 79E7E0DB marked as ultimately trusted public and secret key created and signed. gpg: checking the trustdb gpg: 3 marginal(s) needed, 1 complete(s) needed, classic trust model gpg: depth: 0 valid: 2 signed: 13 trust: 0-, 0q, 0n, 0m, 0f, 2u gpg: depth: 1 valid: 13 signed: 2 trust: 13-, 0q, 0n, 0m, 0f, 0u gpg: next trustdb check due at 2007-12-31 pub 1024D/79E7E0DB 2007-10-08 Key fingerprint = 5ACE 5EBF ED46 BAF7 93BD 8F02 E0BB DB6B 79E7 E0DB uid Repository Owner sub 2048g/04F5FDBA 2007-10-08 configuring your build env. to use key Add the following to your $HOME/.rpmmacros file: %_signature gpg %_gpg_name Repository Owner NOTE: The tag %_gpg_name should match the output of your key creation, this will tell rpm which key you wish to use to sign by default. sign an RPM $ rpm --resign sabayon-2.12.1-1.src.rpm Enter pass phrase: Pass phrase is good. sabayon-2.12.1-1.src.rpm: Now verify that the RPM's been signed: $ rpm -K sabayon-2.12.1-1.src.rpm sabayon-2.12.1-1.src.rpm: (SHA1) DSA sha1 md5 (GPG) NOT OK (MISSING KEYS: GPG#79e7e0db) This is actually OK. It's just telling you that the RPM's been signed, but that your RPM installation doesn't have the corresponding key that goes along with this signing. saving the key You can extract the key we generated above with this command: $ gpg --export -a "Repository Owner " >RPM-GPG-KEY-example.com You can import it with this command: $ rpm --import RPM-GPG-KEY-example.com And confirm that it loaded with this: $ rpm -q gpg-pubkey-* gpg-pubkey-f51839ac-46362566 gpg-pubkey-b2980b13-3c1d0597 gpg-pubkey-44cb93fd-4a68c9c4
How to create and sign a RPM-package with RedHat 4, that works with YUM?
1,536,161,877,000
I was preparing my Kali Linux to run a Tor's Middle Relay. I was doing Tor Project's Repository configuration according to this site. I made steps 1 and 2. The 3rd step was to add the gpg key used to sign the packages by running the following command: sudo wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null The problem is I don't understand what this command does and why it fails, even though I execute it with sudo permissions. ┌──(michal㉿kali)-[/usr/share/keyrings] └─$ sudo wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null [sudo] password for michal: tee: /usr/share/keyrings/tor-archive-keyring.gpg: Permission denied This part with wget, I understand. But I don't know what is happening after the tor repo gets downloaded to my vps. ┌──(michal㉿kali)-[/usr/share/keyrings] └─$ ls -lah total 176K drwxr-xr-x 2 root root 4.0K Jan 28 2022 . drwxr-xr-x 135 root root 4.0K Jan 3 18:09 .. -rw-r--r-- 1 root root 8.5K Feb 25 2021 debian-archive-bullseye-automatic.gpg -rw-r--r-- 1 root root 8.6K Feb 25 2021 debian-archive-bullseye-security-automatic.gpg -rw-r--r-- 1 root root 2.4K Feb 25 2021 debian-archive-bullseye-stable.gpg -rw-r--r-- 1 root root 8.0K Feb 25 2021 debian-archive-buster-automatic.gpg -rw-r--r-- 1 root root 8.0K Feb 25 2021 debian-archive-buster-security-automatic.gpg -rw-r--r-- 1 root root 2.3K Feb 25 2021 debian-archive-buster-stable.gpg -rw-r--r-- 1 root root 55K Feb 25 2021 debian-archive-keyring.gpg -rw-r--r-- 1 root root 37K Feb 25 2021 debian-archive-removed-keys.gpg -rw-r--r-- 1 root root 7.3K Feb 25 2021 debian-archive-stretch-automatic.gpg -rw-r--r-- 1 root root 7.3K Feb 25 2021 debian-archive-stretch-security-automatic.gpg -rw-r--r-- 1 root root 2.3K Feb 25 2021 debian-archive-stretch-stable.gpg -rw-r--r-- 1 root root 2.3K Jan 25 2022 kali-archive-keyring.gpg ┌──(michal㉿kali)-[/usr/share/keyrings] └─$ lsb_release -a 1 ⨯ No LSB modules are available. Distributor ID: Kali Description: Kali GNU/Linux Rolling Release: 2022.4 Codename: kali-rolling
First, let's break down what's happening. sudo is only being used to run wget, not the rest of the command. What you did is functionally equivalent to: # 1. Download a file and save as 'file.asc' sudo wget -qO- https://d...E886DDD89.asc > file.asc # 2. Dearmor that file (generates file.asc.gpg) gpg --dearmor file.asc # 3. Copy that file to /usr/share/keyrings tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null <file.asc.gpg So you see, you used sudo to download the file. That doesn't really do much in this situation, except make file.asc owned by root. In your case, the file is piped onto stdout, so sudo really doesn't do much. Next, you used gpg --dearmor, which is fine. Finally, you used tee to copy the contents of the file to your system. This is the part that needs root permissions because you are writing to a root-owned directory. The answer is to run tee with sudo. Functionally this would look like: # 1. Download a file and save as 'file.asc' wget -qO- https://d...E886DDD89.asc > file.asc # 2. Dearmor that file (generates file.asc.gpg) gpg --dearmor file.asc # 3. Copy that file to /usr/share/keyrings sudo tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null <file.asc.gpg In your 1-liner, it would look like: wget -qO- \ https://deb...6DDD89.asc | \ gpg --dearmor | \ sudo tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null or wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | sudo tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null In fact, the reason we | tee /usr/share... >/dev/null instead of the much simpler >/usr/share... is so we can prefix tee with sudo.
Add the gpg key used to sign the packages by running the following wget | gpg | tee >/dev/null command
1,654,863,431,000
I have a Sipeed Lichee RV that runs a Debian image, but I cannot install software due to missing key. I have followed the Package Authentication Instructions but am getting this error: root@sipeed:/etc/apt# gpg --keyserver hkps://keys.openpgp.org --recv-keys 0xE852514F5DF312F6 gpg: key E852514F5DF312F6: new key but contains no user ID - skipped gpg: Total number processed: 1 gpg: w/o user IDs: 1 My sources.list file contains: deb http://ftp.ports.debian.org/debian-ports/ sid main The apt update command returns The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E852514F5DF312F6
If you can't import the gpg key, you can install the debian-ports-archive-keyring manually. wget http://ftp.us.debian.org/debian/pool/main/d/debian-ports-archive-keyring/debian-ports-archive-keyring_2022.02.15_all.deb sudo dpkg -i debian-ports-archive-keyring_2022.02.15_all.deb Or use: wget -O - https://www.ports.debian.org/archive_2022.key |sudo apt-key add - As montionned in the debian ports webpage.
Setting up debian archive keys on risc64: new key but contains no user ID
1,654,863,431,000
SHORT GPG doesn't get signatures of an imported public key anymore (with Ubuntu 20.04) while it did it 6 months ago (with Ubuntu 18.04). I don't understand what's wrong. LONG On march, I followed this mini HOW-TO in order to verify an Ubuntu ISO. And when I imported the public key which signed the checksum file to verify the ISO file, I had a message saying this new key had 72 signatures. I listed the signatures of this key, so I could find fingerprints and import these 72 public keys. And so on, I could move up the chain of trust until I could find a trustable key (if I understood everything). But since this date, I've reinstalled my OS, so all GPG keys have been deleted. And now, when I do the same manipulation, the first imported public key has no signatures at all. So how can I move up the chain of trust ? Is there something I'm missing ? Thanks for your help. Below are the commands done on March and today to see the differences. 1) Commands on March with Ubuntu 18.04 (Yes, I copied it at this time to have an example) : $ gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 843938DF228D22F7B3742BC0D94AA3F0EFE21092 gpg: key D94AA3F0EFE21092: 2 duplicate signatures removed gpg: key D94AA3F0EFE21092: 72 signatures not checked due to missing keys gpg: key D94AA3F0EFE21092: public key "Ubuntu CD Image Automatic Signing Key (2012) <[email protected]>" imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 $ gpg --list-signatures 843938DF228D22F7B3742BC0D94AA3F0EFE21092 pub rsa4096/D94AA3F0EFE21092 2012-05-11 [SC] 843938DF228D22F7B3742BC0D94AA3F0EFE21092 uid [ unknown] Ubuntu CD Image Automatic Signing Key (2012) <[email protected]> sig 3 D94AA3F0EFE21092 2012-05-11 Ubuntu CD Image Automatic Signing Key (2012) <[email protected]> sig 0BFB847F3F272F5B 2012-05-11 [User ID not found] sig 393587D97D86500B 2012-05-11 [User ID not found] sig 5759F35001AA4A64 2012-05-12 [User ID not found] ... 2) Commands of today with Ubuntu 20.04 $ gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 843938DF228D22F7B3742BC0D94AA3F0EFE21092 gpg: key D94AA3F0EFE21092: public key "Ubuntu CD Image Automatic Signing Key (2012) <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1 $ gpg --list-signatures 843938DF228D22F7B3742BC0D94AA3F0EFE21092 pub rsa4096 2012-05-11 [SC] 843938DF228D22F7B3742BC0D94AA3F0EFE21092 uid [ unknown] Ubuntu CD Image Automatic Signing Key (2012) <[email protected]> sig 3 D94AA3F0EFE21092 2012-05-11 Ubuntu CD Image Automatic Signing Key (2012) <[email protected]> $ As we can see in command of today, there are no more 72 signatures.
Sadly, it's the usual reason why whe can't have nice things: someone found out how to abuse the GPG ecosystem, and then did exactly that. The SKS keyserver network has had known vulnerabilities for several years, and in mid-2019 someone finally started exploiting those vulnerabilities in significant volume, resubmitting legitimate users' public keys after adding fake user IDs or revocation certificates, or simply adding ridiculous numbers of signatures to keys. https://code.firstlook.media/the-death-of-sks-pgp-keyservers-and-how-first-look-media-is-handling-it https://gist.github.com/rjhansen/67ab921ffb4084c865b3618d6955275f As a result, the GPG "web of trust" got some major damage done to it, and GPG had to be updated to be more careful about "poisoned" keys, revocation certificates and signatures. On new installations, the default settings of GPG will (hopefully) now be adapted to the new situation. To mitigate the damage, a new keyserver implementation, "Hagrid", strips all (non-self) signatures from keys, and in order to have an user ID attached to the key, a double opt-in validation is needed. Sadly, that complicates rebuilding of the trust chains. You can still get the actual key material from the keyservers, but you'll need to do more of your own legwork to determine whether you'll trust the identity associated with the key or not.
GPG : no more signatures of a fresh imported key
1,654,863,431,000
Information: GPG version: 2.2.23 Docker version 20.10.5 I am playing around with GPG on my laptop and trying to reuse it inside docker container. The docker container is simply a PHP-FPM alpine image. I have simple PHP CLI tool which encrypt/decrypts data with GPG. I exported the GPG from host and imported it inside container. The problem though, I always need to provide passphrase for PHP to decrypt the data. I would like to avoid passphrase in container for sake of security. Further I discovered the gpg-agent with gpg-preset-passphrase and preconfigured it inside the container, but later on found that this isn't optimal, because once I restart the container or destroy it, I will need to start gpg-agent and set passphrase again. So, I was wondering, is there a way to pass gpg-agent with cached passphrase inside docker and so docker would reuse it to encrypt/decrypt the data? I know there is possibility to reuse ssh-agent inside docker, but couldn't really find a way to do the same for GPG. Or maybe there is a better/secure way of doing it?
I would say the resolution was very simple. GPG First of all, you need to start gpg-agent: gpg-agent --verbose --daemon --log-file /tmp/gpg-agent.log --allow-preset-passphrase --default-cache-ttl=31536000 This will start gpg-agent in background. You can verify that it is running: ps aux | grep gpg Now you need to use gpg-preset-passphrase to preset passphrase for the private key. gpg-preset-passphrase is not located in the /usr/local/bin, so you need to find it: sudo find / -name gpg-preset-passphrase In my case it was /usr/local/Cellar/gnupg/2.3.1_1/libexec/gpg-preset-passphrase, so now run the following command to find out private KEYID: gpg-connect-agent 'keyinfo --list' /bye Sample output: S KEYINFO 4B86D9FBE0D9617C6EB4B42015C9B2AC8XXXXXXX D - - - P - - - S KEYINFO 8960D3408E09A1A111AA862DBFB1B16CFXXXXXXX D - - - P - - - OK In my case it is two keys, choose one of the KEY IDs. echo "your-secret-passphrase" | /your/path/to/gpg-preset-passphrase --verbose --preset 4B86D9FBE0D9617C6EB4B42015C9B2AC8XXXXXXX Replace your-secret-passphrase with your password, /your/path/to/ with your path and 4B86D9FBE0D9617C6EB4B42015C9B2AC8XXXXXXX with your own KEYID. Now run the following command again to verify that passphrase was set successfully: gpg-connect-agent 'keyinfo --list' /bye If you see "1" near the KEYID you've chosen, it means passphrase set successfully. Let's verify by doing encrypt and decrypt: echo "hello" | gpg --armor --encrypt --recipient [email protected] | gpg --decrypt Replace [email protected] with your email. GPG Agent Forwarding via SSH Add the following to your ~/.ssh/config Host gpgtunnel User user HostName server-ip Port 22 RemoteForward /root/.gnupg/S.gpg-agent /home/user/.gnupg/S.gpg-agent IdentityFile ~/.ssh/id_rsa RemoteForward has the following signature: <remote path> <local path>. You can find location of local path by running: gpgconf --list-dir agent-extra-socket ssh to you server and find remote path by running: gpgconf --list-dir agent-socket Some note about S.gpg-agent vs S.gpg-agent.extra. S.gpg-agent allows to do export of the private key and other manipulation with keys, where is S.gpg-agent.extra is a very limit version which allows only encrypt/decrypt operation. Now you need to export public key to remote sever, you can use the following command: gpg --export [email protected] | ssh -p 22 user@remote-server gpg --import Replace [email protected] with your GPG email. Ensure you have imported public key successfully: ssh -p 22 user@remote-server gpg -k Testing Now try to run ssh gpgtunnel and do encrypt/decrypt on the server. Now server should be able to reuse your local gpg-agent socket. echo "hello" | gpg --armor --encrypt --recipient [email protected] | gpg --decrypt If for some reason this doesn't work, you may run the following SSH command from your local computer: ssh -fNT gpgtunnel This will put SSH to background (-f flag). Now ssh gpgtunnel normally and retry encrypt/decrypt command from above again. Resources https://wiki.gnupg.org/AgentForwarding https://habd.as/post/moving-gpg-keys-privately/
How to forward gpg-agent from host to docker container and reuse cached passphrase?
1,654,863,431,000
I have: A file A detached PGP signature of that file in ASCII armor format and A 40-character (long-format) fingerprint identifying the one key that must have a valid signature What is the correct way to write a BASH script to verify that the given signature is valid (only for the given fingerprint) for the given file using the gpg command on *nix? Note: The solution ideally would not just parse STDOUT from gpg--such that the BASH script in the solution provided wouldn't break if the words or format of the output are slightly changed in the future. And, especially important, detached signatures can be signed by multiple keys. So this solution should fail if, for example, an attacker took the file and its detached signature and edited the file while adding their own signature to the detached signature. Note that, with this attack, there would be a BAD signature present from the key whose fingerprint we're pinning in our script and a GOOD signature from the attacker's key, which is irrelevant. In this case, the solution must fail. For example, consider the following: https://files.pythonhosted.org/packages/cb/85/8a1588a04172e0853352ecfe214264c65a62ab35374d9ad9c569cf94c2a3/python_gnupg-0.4.6-py2.py3-none-any.whl https://files.pythonhosted.org/packages/cb/85/8a1588a04172e0853352ecfe214264c65a62ab35374d9ad9c569cf94c2a3/python_gnupg-0.4.6-py2.py3-none-any.whl.asc CA749061914EAC138E66EADB9147B477339A9B86 Currently I have the following in my BASH script #!/bin/bash ONLY_TRUST_THIS_FINGERPRINT='CA749061914EAC138E66EADB9147B477339A9B86' tmpDir="`mktemp -d`" || exit 1 pushd "${tmpDir}" wget https://files.pythonhosted.org/packages/cb/85/8a1588a04172e0853352ecfe214264c65a62ab35374d9ad9c569cf94c2a3/python_gnupg-0.4.6-py2.py3-none-any.whl wget https://files.pythonhosted.org/packages/cb/85/8a1588a04172e0853352ecfe214264c65a62ab35374d9ad9c569cf94c2a3/python_gnupg-0.4.6-py2.py3-none-any.whl.asc wget https://keys.openpgp.org/vks/v1/by-fingerprint/CA749061914EAC138E66EADB9147B477339A9B86 mkdir gnupg gpg --homedir "${tmpDir}/gnupg" --import CA749061914EAC138E66EADB9147B477339A9B86 What command(s) should follow in the script above to safely confirm that the file has a valid signature from the private key matching our pinned fingerprint? EDIT: Here's an example output of a simple gpg --verify ... that has a GOOD signature by an attacker and a BAD signature from the actual developer; it should fail. user@disp2952:/tmp/tmp.nUmxfwbwfK$ gpg --homedir gnupg/ --verify python_gnupg-0.4.6-py2.py3-none-any.whl.asc gpg: WARNING: unsafe permissions on homedir '/tmp/tmp.nUmxfwbwfK/gnupg' gpg: assuming signed data in 'python_gnupg-0.4.6-py2.py3-none-any.whl' gpg: Signature made Sat 29 Aug 2020 10:04:03 PM +0545 gpg: using RSA key 2DA3BAD0DB41087CA7E5E4C1F93C17B957F73F5A gpg: Good signature from "Mallory <[email protected]>" [unknown] gpg: Signature made Fri 17 Apr 2020 07:54:23 PM +0545 gpg: using RSA key 9147B477339A9B86 gpg: BAD signature from "Vinay Sajip (CODE SIGNING KEY) <[email protected]>" [unknown] user@disp2952:/tmp/tmp.nUmxfwbwfK$ echo $? 1 user@disp2952:/tmp/tmp.nUmxfwbwfK$
Use gpgv: gpgv --homedir "${tmpDir}/gnupg" --keyring "${tmpDir}/gnupg/pubring.kbx" python_gnupg-0.4.6-py2.py3-none-any.whl.asc python_gnupg-0.4.6-py2.py3-none-any.whl It will only indicate success (exit code 0) if all signatures are verified using keys in the given keyring. If you want to check that the key you imported matched the fingerprint you asked for, you can ask gpg to list the keys in the keyring that match the fingerprint: gpg --homedir "${tmpDir}/gnupg" --no-default-keyring --keyring "${tmpDir}/gnupg/pubring.kbx" --list-keys "${ONLY_TRUST_THIS_FINGERPRINT}" This will indicate success if the key exists in the keyring, failure otherwise. If you want to improve the trust checking, you should really store the downloaded key, and always used the stored key to verify the downloads, instead of re-downloading the key every time. This is the approach used in some distributions (Debian in particular) to validate new upstream releases: the known-good key is stored in the package source (in Debian, not upstream), and new releases are only validated if they are signed by the known-good key.
Correct way to verify PGP signature in BASH script (pinning exact long fingerprint)
1,654,863,431,000
Recent versions of gpg launch a persistent user process (gpg-agent) when generating keys. This process remains running even after the command terminates. I want to change this behavior. Currently, I'm using unshare and PID namespaces to isolate and kill off anything that gpg leaves running. Unfortunately, this approach requires elevated privileges that may not always be available (root and access to pid/mount namespace). Is there a way for a script to "cleanly" generate gpg keys using gpg without leaving processes running, or requiring elevated privileges? For the sake of completion, the following roughly illustrates my current setup: sudo unshare -fp --mount-proc sh -c 'gpg --homedir /tmp/TEMP_DIR --generate-key --batch; kill -9 -1' <<EOF Key-Type: DSA Key-Length: 768 Name-Real: TEMPKEY Name-Comment: TEMPKEY Name-Email: noreply@localhost Expire-Date: 0 %no-protection EOF
One possibility is to stop the agent once you no longer need it: gpgconf --kill gpg-agent Since you’re using a custom home directory, you need to set GNUPGHOME or specify --homedir: GNUPGHOME=/tmp/TEMP_DIR gpgconf --kill gpg-agent If you want to stop all GnuPG-related processes, specify all instead of gpg-agent.
How can I generate gpg keys in scripts without leaving gpg-agent running?
1,654,863,431,000
I've deleted some keys from /etc/apt/trusted.gpg and trusted.gpg.d. Then i use apt update and get this message: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. The following signatures were invalid: NO_PUBKEY 4C6E74D6C0A35108 It seems like i just going to install old version of app. So my question is: where do apt keep this "previous index files" and where does it get signature 4C6E74D6C0A35108 since it is not in Release file (pgp-signed file with packages hashes).
The previous index files are stored in /var/lib/apt/lists. They’re the last index files which apt successfully downloaded and verified. The key is determined by looking at the Release signature, which isn’t in the Release file itself but in Release.gpg alongside it. Some repositories have an InRelease file which has the contents of Release with an inline signature. In your case, the missing key is the PackageCloud Atom key; follow these instructions to restore it.
Old index files of repositories
1,654,863,431,000
I have created a binary deb package with dpkg-deb command. It is installable and works. > dpkg-deb --build /test dpkg-deb: building package `xxx' in `test.deb'. Now I want to sign the package, but debsigs failed with errors: > debsigs --sign=maint -k XXX /test.deb no entry data.tar.gz in archive Was it a problem with dpkg-deb? EDIT > ar t /test.deb debian-binary control.tar.gz data.tar.xz _gpgmaint
Your version of dpkg-deb produced a .deb package containing an xz-compressed data.tar, but your version of debsigs doesn’t support that, it only supports gzip-compressed data.tar components. To solve this, there are two possible approaches: upgrade debsigs to 0.1.18 or later (which is widely available, albeit not in Ubuntu Precise or Trusty, which is presumably what you’re using); force dpkg-deb to compress using gzip, by adding -Zgzip to the dpkg-deb command.
debsign: no entry data.tar.gz in archive error
1,654,863,431,000
I have found a strange error. It is OK when I commit using gpg with git under bash or zsh. git commit -S -m "xxx" However when I commit it under tmux, I got: gpg: signing failed: Operation cancelled gpg: signing failed: Operation cancelled error: gpg failed to sign the data fatal: failed to write commit object
You need to ensure that your GPG_TTY variable is correct; add GPG_TTY=$(tty) export GPG_TTY to your shell startup scripts, including for non-login shells (your login shells are probably OK, but not non-login shells, which is why this fails in tmux).
gpg: signing failed: Operation cancelled under tmux?
1,654,863,431,000
Earlier on today I decided to backup my laptop and re-install everything. I thought I backed up the GPG keys correctly but it turns out I only exported my public key. I understand that I can't get that key back as I failed to back it up correctly. My question though is, can I re-generate a new secret key and assign it to the public key exported earlier? or should I just create another key/pair but then I would have 3 keys on my PC the old public key and then the new generated keys each would have the same name and email address - Is this the correct thing to do?
Your old private key is gone so about all your old public key is good for is 'legacy' usage. (i.e. you won't be doing anything new with it but it could be used to verify anything previously signed, for example) Going forward, everything would be based on your new private/public key pair which have no relation to your old keys. Also, since it doesn't sound like your old key used a CA you'll have to manually make sure that any people/services that need to be are notified and get your new public key.
GPG Lost Secret Key
1,654,863,431,000
Given a detached signature mydoc.sig of a document mydoc produced with gpg --local-user <GPG_RECIPIENT> --detach-sig mydoc How can I create a printable output of this signature in base16 (as when exporting a private key with paperkey)? The ASCII armor signature is a convenient output to be printed, Obviously the following is not working cat mydoc.sig | paperkey Unable to find secret key packet I am looking for a output like the one below:
od -t x1 mydoc.sig produces similar output that should be just as usable. As you presumably know since you mention it in your question, you can also create an ASCII-armored signature using gpg --detach-sig -a mydoc I don’t know whether you’d consider that good enough for printing as-is though. There’s not much point piping that through od, it will include a CRC but it will also be quite a bit longer than the piped binary signature.
How to produce a printable PGP detached signature (eventually in base16)?
1,654,863,431,000
I want decrypt some gpg files, output into a file. But each time gpg ask password. for i in *.gpg; do echo $i>>~/t; gpg -d --batch $i >>~/t; done I test --multifile and --batch, those not as my wish.
Several ways: # gather the password into $P stty -echo; read -r P; stty echo; for i in *.gpg; do printf '%s\n' "$i" >> ~/t; printf '%s' | gpg -d --batch --passphrase-fd 0 "$i" >> ~/t; done # gather the password into $P stty -echo; read -r P; stty echo; for i in *.gpg; do printf '%s\n' "$i" >> ~/t; gpg -d --batch --passphrase "$P" "$i" >> ~/t; done d=$(mktemp -d) # gather the password into a file named `p` stty -echo; cat > "$d/p"; stty echo for i in *.gpg; do printf '%s\n' "$i" >> ~/t; gpg -d --batch --passphrase-file "$d/p" 0 "$i" >> ~/t; done rm -rf "$d"
How can I input password only once when gpg decrypt files in batch
1,654,863,431,000
I want to generate a GPG key interactively in expert mode. gpg --expert --gen-key I only have the name, email and a prompt for a passphrase, no key size, key type, etc., why would it be so?
I guess this is version dependent. Try --full-gen-key instead of --gen-key. You can also try gpg2 instead of gpg.
Why are gpg key options not displayed when generating a key?
1,654,863,431,000
Using the --keyring option, I'm unable to export public keys with gpg: $ gpg -vv --armor --keyring pubring.gpg --export gpg: writing to stdout gpg: WARNING: nothing exported Yet it works with --homedir: $ gpg --armor --homedir . --export -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v2.0.14 (GNU/Linux) ... What's the reason for this? Is there a workaround?
From the gpg man page: --keyring file Add file to the current list of keyrings. If file begins with a tilde and a slash, these are replaced by the $HOME directory. If the filename does not contain a slash, it is assumed to be in the GnuPG home directory ("~/.gnupg" if --homedir or $GNUPGHOME is not used). The filename given to --keyring (and other options, like --secret-keyring and --trustdb-name) must have a slash in it, otherwise gpg looks for it in the GnuPG home directory. You would want to use: gpg -vv --armor --keyring ./pubring.gpg --export
Unable to export public keys with gpg using --keyring
1,654,863,431,000
I am trying to setup my Nitrokey (GPG usb Smartcard). I got it to work by adding reader-port into the scdaemon config file. I had to do this because my laptop has multiple built in smartcard readers. It seems to work if the Nitrokey is plugged in at boot. If it isn't I need to restart pcscd manually. It seems that even though the reader-port is defined in the config it only works if the nitrokey is the first reader (pcsc_scan -n). How could I debug this? It should detect the smartcard after boot (even if it's not the first reader) without manually restarting any services.
I admit it's more a work-around than a clean solution but you can use a udev rule for restarting pcscd. I have a similar problem with scdaemon. I use udev to restart scdaemon on plugging in a smartcard reader by adding this to the udev rule: RUN+="/usr/bin/killall -9 scdaemon"
scdaemon/gpg doesn't work
1,654,863,431,000
What is the binary export / import format used bygpg for public and private keys?
The format is defined in RfC 4880 (e.g. section 5.5 Key Material Packet).
Export format of gpg [closed]
1,654,863,431,000
The commands gpg --export and gpg --export-secret-keys can be used to export keys in a binary format. Is there any command available to examine these exported binary key files? I need to see if the exported files contain some extra fields or any other incompatibility problems.
gpg --list-packets keyfile.gpg Even possible as gpg --export 0x12345678 | gpg --list-packets gpg --export-secret-keys 0x12345678 | gpg --list-packets
Examine exported binary gpg key
1,654,863,431,000
I've written a little script for my Clonezilla USB stick which will allow me to quickly back everything up without entering any options by simply running the script. Next, I'd like to store my public GPG key on the stick and add some encryption to my backups like so: find . -maxdepth 1 -type f -not -iname "*.gpg" | while read file ; do gpg --encrypt-using-key-file "/path/to/my/keyfile" "$file" rm "$file" done What is the way to properly encrypt files using a public GPG keyfile, ensuring that it doesn't prompt for user input? How would I actually do this?
You must have the target key in the keyring. I am not sure whether it is necessary that the target key is valid; better make it so. You should use a config directory on the stick. With this directory being empty you import the key: gpg --homedir /dir/on/stick --import /target/key.asc This needs to be done just once. From your script you do this: gpg --homedir /dir/on/stick --trust-model always --recipient 0x12345678 \ --output /path/to/encrypted_file.gpg --encrypt /source/file You may consider creating a signature for the file, too. But that would make the operation a bit more complicated.
Batch encryption using a public GPG key
1,654,863,431,000
The import command saves screenshot in a file. Is there a way to encrypt that file at the same time using gpg, without saving the image file first? gpg accepts input from stdin but it seems that import doesn't support writing files to stdout, so I can't pipe output of the import to gpg.
The import command on my system supports writing to stdout. Just use - as the filename. You'll probably want to prefix that with the image format you want, e.g.: import png:- | gpg ...
Encrypting import's output with gpg at the same time
1,654,863,431,000
The GnuGPG passphrase prompt dialog box timesout after 60 seconds. How do I increase the timeout period ? (Just to clarify that I am not looking for default-cache-ttl but the timeout of the passphrase dialog box itself. I am using GnuPG v2.2.23 on Fedora 33).
You can increase timeout period of passphrase prompt dialogue box by adding the following line to $HOME/.gnupg/gpg-agent.conf[0] pinentry-timeout 120 Now the passphrase popup will wait for 120 seconds. To load the above config restart gpg-agent by running[1] gpgconf --kill gpg-agent gpg-agent will be started automatically on running gpg command. [0] https://www.gnupg.org/documentation/manuals/gnupg24/gpg-agent.1.html [1] https://superuser.com/a/1150399
How to increase GnuGPG passphrase dialog box timeout?
1,654,863,431,000
I use GNU's password store (pass) to save all my passwords including my email passwords. I have a passphrase set on my GPG keys which is then remembered by gpg-agent for an hour. I also have a cron job that pulls my emails at regular intervals which obtains the email passwords using pass. What this means is that the cron job only works when I have entered my passphrase so that the gpg-agent remembers the passphrase. Otherwise the cron job fails. I would like to always have the passphrase remembered for this one cron job, but not for other processes. Is there a way to do so? What is the correct way to handle such a use-case? I am tempted to remove the passphrase all together.
You don't need to remove passphrases for all your keys. However, gpg-agent is not designed to have multiple settings for different keys. Therefore, I think your best bet is to create an additional password store associated with a different gpg key without a passphrase and use that for your cron jobs. Basically, create a new directory (e.g. cronjob_key) in your password store, a new key (gpg --full-generate-key) without passphrase and set that directory as the path in pass init -p cronjob-key [GPG-ID]. You can apply the same procedure for your old key and have the following directory structure: |-- old_key | |-- .gpg-id |-- cronjob_key |-- .gpg-id Now you can generate new passwords for each password store: pass generate cronjob_key/service2 16 and pass generate old_key/service1 16: |-- old_key | |-- .gpg-id | `-- service1.gpg `-- cronjob_key |-- .gpg-id `-- service2.gpg -> this one doesn't require passphrase You need to assume that if your computer gets compromised, then the attacker will have access to services using this "passwordless" key. That's the trade-off you must be willing to make for the convenience of automating your cronjobs. This is equivalent to the use of cookies available in most web services, so it shouldn't be to difficult to accept this as a viable alternative.
Remembering gpg pass-phrase for certain processes
1,654,863,431,000
I've tried all methods published in older questions, such as adding from ubuntu.keyserver, using gpg, from hkp://pool.sks-keyservers.net:80 etc, any ideas ¿? gpg: gpg --recv-keys 0E61D3BBAAEE37FE gpg: recepción del servidor de claves fallida: No data ubuntu keyserver: Executing: /tmp/apt-key-gpghome.zPtWaE6tzD/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 0E61D3BBAAEE37FE gpg: recepción del servidor de claves fallida: No data pool.sks-keyserver: sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys 0E61D3BBAAEE37FE Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). Executing: /tmp/apt-key-gpghome.qLLaSgFMSM/gpg.1.sh --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys 0E61D3BBAAEE37FE gpg: recepción del servidor de claves fallida: Server indicated a failure
Your default server, and the Ubuntu keyserver, aren’t down; they just don’t have the key you’re asking for. 0E61D3BBAAEE37FE isn’t available from any keyserver I’m aware of.
no public key on debian 11 unable to apt update
1,654,863,431,000
I am currently trying to automate the encryption and decryption of a collection of files. For the encryption I currently use: gpg --batch --recipient [RECIPIENT] --encrypt-files [FILES] For the decryption I use pretty much the same: gpg --batch --decrypt-files [FILES] But both during encryption as well as decryption the original file permissions are lost: $ gpg --batch --recipient aram --encrypt-files foo $ ls -l foo* -rw------- 1 aram aram foo -rw-r--r-- 1 aram aram foo.gpg $ rm foo && gpg --batch --decrypt-files foo $ ls -l foo* -rw-r--r-- 1 aram aram foo -rw-r--r-- 1 aram aram foo.gpg I am OK with it during encryption, I can set the file permissions manually. But during decryption, as well as posing a security risk, some files like ssh keys use functionality without proper permissions. Is there a mechanism that retains file permissions during batch decryption? Of course I can loop over the files, read the permission, decrypt and then set the permissions again. But that kind of defeats the point of batch decrypting. There is an open issue on gnupg.org that's 4 years old now and hasn't had much activity since then: https://dev.gnupg.org/T2945
As @a-b and @frostschutz suggested, wrapping the files in a tar file and then encrypting is an option. However, I would like to have access to the original file structure without decrypting. For now, I have resorted to aligning the file permissions after the batch decryption. This has the additional benefit of aligning permissions when the decrypted files are already lying around on disk: gpg --batch --decrypt-files $files for encrypted in $files ; do decrypted=${encrypted%.gpg} chmod --reference="$encrypted" -- "$decrypted" done Of course, the alignment can also be done after each decrypted file: for encrypted in $files ; do gpg --decrypt-files "$encrypted" decrypted=${encrypted%.gpg} chmod --reference="$encrypted" -- "$decrypted" done If you want to be absolutely sure that the decrypted file never has more permissions than the encrypted file, you can use a temporary dummy file and force gpg to overwrite it: for encrypted in $files ; do decrypted=${encrypted%.gpg} touch "$decrypted" && chmod --reference="$encrypted" -- "$decrypted" gpg --yes --decrypt-files "$encrypted" done The same mechanism can be used for aligning permissions after encryption. I have not done any performance testing, not sure if one of the options is faster. I will not accept this as an answer right away, maybe somebody comes up with a better solution than this.
How do I decrypt files with gpg / gnupg without loosing the original file permissions?
1,654,863,431,000
I'm trying to verify the SHA512 checksum for Debian 10.5-amd-netinst.iso as found on the official Debian CD-image site. I'm running into the following error: gpg --no-default-keyring --keyring Debian\ CD\ signing\ key\ \(6294BE9B\)\ –\ Public.asc --verify SHA512SUMS.sign gpg: assuming signed data in 'SHA512SUMS' gpg: Signature made Sat 1 Aug 22:01:33 2020 EDT gpg: using RSA key DF9B9C49EAA9298432589D76DA87E80D6294BE9B gpg: key DA87E80D6294BE9B: new key but contains no user ID - skipped gpg: Total number processed: 1 gpg: w/o user IDs: 1 gpg: Can't check signature: No public key Looking across the web and other posts, a few people suggested using different keyring servers to retrieve the key because some of them have an owner approval system that will strip all user IDs unless the owner of the corresponding email address has allowed them to be published. I've tried a dozen different key servers and none of them seem to solve the issue. Any thoughts on what the issue could be or how I can solve it?
The GnuPG --keyring argument doesn't accept an ASCII-armored file as input. The easiest way to verify this is to do this: $ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys DF9B9C49EAA9298432589D76DA87E80D6294BE9B $ gpg --no-armor -o keyring.gpg --export DF9B9C49EAA9298432589D76DA87E80D6294BE9B $ gpg --no-default-keyring --keyring keyring.gpg --keyserver-options none --verify SHA512SUMS.sign Do note that you can also use gpgv to verify data if you want to restrict verification to a specific set of keyrings and not fetch the keys from a keyserver if they're missing. If you're looking into doing this in a program and need more than the exit status, --status-fd is your friend.
Verifying Signature of Debian 10.5 returns error "Can't check signature: No public key"
1,654,863,431,000
System: Linux Mint 19 Cinnamon, based on Ubuntu 18.04. Upon my limited knowledge of gpg, which version I will state here for future references: gpg (GnuPG) 2.2.4 libgcrypt 1.8.1 I thought the following command does not need anything special specified: $ gpg --recv-keys 402543B2D98854007F627D36A63A58A3F2E17569 But I get the following error upon executing it: gpg: keyserver receive failed: Address family not supported by protocol Sometimes, it works as expected, so I am unsure how to proceed, I am unable to pinpoint the problem? Note, that I only have IPv4, no IPv6, if that is relevant.
Cause This error may happen when one is not connected to IPv6 network. Source I have just installed GnuPG on my FreeBSD, and it kindly informed me, quoting: GnuPG, when run on hosts without IPv6 connectivity, may fail to connect to dual-stack hkp servers. Workaround on FreeBSD Add this line: disable-ipv6 to the file: /usr/local/etc/dirmngr.conf Applied to Linux Mint 19 To make sure that new options are read and that after the installation of a new GnuPG version the installed dirmngr is running, you may want to kill an existing dirmngr first: sudo gpgconf --kill dirmngr Applied to my Linux Mint 19, there is no default location of this config file. Various places are read, I will only note that I have successfully created the file in: ~/.gnupg/dirmngr.conf In addition to answering the question, let me note, that should you encounter any further errors, add this to the config file too: debug-level guru log-file ~/.gnupg/dirmngr.log
gpg: keyserver receive failed: Address family not supported by protocol
1,654,863,431,000
I am running Devuan Jessie. I want to install another Devuan Ascii from scratch. So I downloaded: https://files.devuan.org/devuan_ascii/installer-iso/devuan_ascii_2.0.0_amd64_netinst.iso https://files.devuan.org/devuan_ascii/installer-iso/SHA256SUMS https://files.devuan.org/devuan_ascii/installer-iso/SHA256SUMS.asc https://files.devuan.org/devuan_ascii/devuan-devs.gpg Update: it is now available at https://files.devuan.org/devuan-devs.gpg But I found no way to authenticate devuan-devs.gpg. Other distros like Debian or Ubuntu or similar allow me to verify the ISO from an existing previous version. But for Devuan, I did not find any way: tino@ts:~/ISO/devuan_ascii-2.0.0$ gpg --verify SHA256SUMS.asc gpg: assuming signed data in `SHA256SUMS' gpg: Signature made Wed 06 Jun 2018 08:55:55 PM CEST using DSA key ID 0B5F062F gpg: Can't check signature: public key not found tino@ts:~/ISO/devuan_ascii-2.0.0$ gpg --no-default-keyring --keyring /usr/share/keyrings/devuan-archive-keyring.gpg --verify SHA256SUMS.asc gpg: assuming signed data in `SHA256SUMS' gpg: Signature made Wed 06 Jun 2018 08:55:55 PM CEST using DSA key ID 0B5F062F gpg: Can't check signature: public key not found tino@ts:~/ISO/devuan_ascii-2.0.0$ gpg --no-default-keyring --keyring /usr/share/keyrings/devuan-keyring.gpg --verify SHA256SUMS.asc gpg: assuming signed data in `SHA256SUMS' gpg: Signature made Wed 06 Jun 2018 08:55:55 PM CEST using DSA key ID 0B5F062F gpg: Can't check signature: public key not found tino@ts:~/ISO/devuan_ascii-2.0.0$ gpg --keyring ../devuan-devs.gpg --verify SHA256SUMS.asc gpg: assuming signed data in `SHA256SUMS' gpg: Signature made Wed 06 Jun 2018 08:55:55 PM CEST using DSA key ID 0B5F062F gpg: Good signature from "Vincenzo (KatolaZ) Nicosia <[email protected]>" gpg: aka "Vincenzo Nicosia (KatolaZ) <[email protected]>" gpg: aka "Vincenzo Nicosia (KatolaZ) <[email protected]>" gpg: aka "KatolaZ <[email protected]>" gpg: aka "Enzo Nicosia <[email protected]>" gpg: aka "Enzo Nicosia -- KatolaZ <[email protected]>" gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F As the "key is not certified", there is no indication that the key is not fake. How can this broken trust chain be fixed? https://devuan.org/os/documentation/dev1fanboy/general-information does not solve this riddle either. Notes: devuan-devs.gpg probably is not fake. However this assumption does not help. There must be some way to ensure, it is not fake. The initial Hen-Egg problem is already solved, as Devuan (Jessie) already runs at my side. There certainly is some better way to authenticate Ascii's ISO than to upgrade Jessie to Ascii. Right?
Unfortunately, there doesn’t appear to be a better way to authenticate the images: all the files involved are downloaded over the same channel; the key used to sign the SHA256SUMS file isn’t available in the previous Devuan release; the key, as provided in the keyring, isn’t signed by any other key; the key, as published to keyservers, is signed, but it isn’t in the strong set, and none of the signatures come from keys which are in the previous Devuan release’s keyring. The fact that the same key is available from the keyservers and in the published keyring might be construed as providing more guarantees, but I’m not sure it does since we still don’t know that the owner is a legitimate Devuan release signer.
How do I verify https://files.devuan.org/devuan-devs.gpg
1,654,863,431,000
I've been using the Déjà Dup backup tool with Linux Mint for a while now and just decided to investigate whether it actually works (short of trying to restore, as I only have one machine and don't want to break it!). In snooping around, I have two questions that I was hoping someone might be able to shed light on: It backs up once per week, but inside the backup location folder the last backup only has around 5 .gpg files on that date (4th April), the many many other files (490-ish .gpg files) are from other dates, with the most being from February this year... why are so few from the recent backup? Why so many (390ish) from one date in February? The total size of the backup files (including all dates) is only 20.5GB (and the files from the last backup are only 176MV)... but the home directory it is supposed to be backing up is about 45GB... why so much difference? Now, I don't know much about the tool but obviously these two issues make me wonder if it's actually working... of course, maybe the files are very compressed, but why so little from the last backup and why just 176MB from these five files compared to the size of what's supposed to be backed up? If anyone can offer some clues as to why 1 and 2 might be the case (and if maybe it shouldn't be this way and maybe it isn't working!) I'd be super grateful :)
I am far from an expert on on this backup tool although I have been using it for about a month now on a new Linux Mint system. First of all, you need to understand that Deja Dup is simply a graphical front end for the tool that actually does the backup - duplicity. Duplicity works by scanning what you have defined to be backed up and searching for differences since the previous backup. The differences are then compressed (and optionally encrypted) and stored in the current backup directory. Thus, the whole process starts with an initial full backup and continues from there with incremental backups. With that in mind, I'll try and address your questions. 1) As mentioned above, the first time you do a backup with duplicity, it backs up all files that you have defined. These files are all lumped together and the resulting backup file could become too large to easily work with. Thus, Duplicity splits it into multiple smaller files (around 50MB) that are individually easier to work with. Once the initial backup is complete, subsequent backups only need to track what has changed and can be significantly smaller. The downside to this approach is that if you want to restore from a specific date, the restore needs to start with the original file and then apply all changes since then until it gets to the target restore date. Thus, it's probably a good idea to periodically do a full backup so that a restore doesn't have to go back so far. I use duplicity directly on a Raspberry Pi to backup weather station data and the script I wrote to do it creates a new full backup at the start of every month. Thus, worst case, restoring a specific data set would only require retrieving the original and applying about 30 delta files. Whether Deja Dup occasionally restarts with a full backup, I don't know. It hasn't so far and I will be keeping my eye on it over the next month or so to see if it's a "keeper". 2) As I mentioned above, the backups are compressed so it's not surprising that they are smaller than the directories being backed up. Also, I just looked at my backups, which are stored on a NAS - the first backup consisted of over 1500 files on 03/28/2018 (all 52.4MB). Since then, it is typically a few backup files per day, although some of these are much larger (I saw one that was almost 900MB). I should also point out that I arrived at your post while searching for a question of my own - how do I restore a single file or directory using Deja Dup? I basically want to go back and look at a couple of files that I deleted a couple of weeks ago, just to compare them to what I'm using now. I could find no way in the rather sparse Deja Dup app to do it. As near as I can tell, it wants to restore my entire backup (fortunately, it can be directed to restore someplace else other than the backup location. However, I have no desire to restore 500GB of data just to look at two files. I'm pretty sure I can do this directly on the command line with Duplicity, so if Deja Dup doesn't support this I will be extremely disappointed and will likely either switch to a different backup tool or write my own. I would also recommend this to you as well - try to restore something and see if you are happy with the results. If not, you can then start looking for a new backup tool before you find out that your current backup tool let you down. One last comment - you can learn more with "man duplicity". You will find that each backup consists of three file types: a manifest file, signature file, and one or more backup files in compressed tar format and optionally encrypted with GnuPG. There are also a few good tutorials on duplicity that you can find with a web search. Dave
Déjà Dup .gpg backup files are significantly less than backed-up material, how to be certain it's working?
1,487,911,853,000
I am looking for a bash script which input is the old and the new password for changing password of a *.gpg file. I encrypted a txt file with command gpg -c. System create a file.txt.gpg. How can I change the passphrase that I created before?
You cannot change the passphrase, but you can decrypt and reencrypt: gpg --decrypt file.txt.gpg | (gpg -c > tmp.gpg && mv tmp.gpg file.txt.gpg) You shouldn't directly redirect to your encrypted file (it still needs to be decrypted) and the && make sure the mv is not executed unless the encryption succeeded. The above will prompt you once for your decryption password and then twice for the encryption.
CentOS - change the password of GPG file by bash script
1,487,911,853,000
I'm a Debian user. I just created my own GPG public key. I'm just wondering if I re-install Linux on my system, is it possible to use the original GPG key or do I have to create a new one? NOTE: If you know any good example sites for using the GPG key, it would be very helpful.
Delete the file ~/.gnupg/random_seed. Then make a backup of the whole directory ~/.gnupg/. Copy it back after reinstalling the OS. Take care to securely erase the files on the backup storage if other people might get access to it (e.g. if it's a USB stick). Usually /home is put on a separate volume so that the user data is not affected by an OS change.
Can I use my original GPG key even though I've re-installed Linux?
1,487,911,853,000
I'm trying to make mutt use a specific GPG key when sending mails to a specific recipient, much like "per-recipient rules" in OpenPGP / Enigmail. For example, if I want to send an email to [email protected] I want to encrypt it with the public key 0xDEADBEEF and when I send an email to [email protected] I want to encrypt it with some other public key 0xBA5EBA11. To this end, I include the following lines in my ~/.mutt/muttrc file: send-hook '~t ^coworker@company\.com$' 'set crypt_autoencrypt ; set crypt_autosign' crypt-hook '~t ^coworker@company\.com$' '0xDEADBEEF' send-hook '~t ^loveydovey@home\.net$' 'set crypt_autoencrypt ; set crypt_autosign' crypt-hook '~t ^loveydovey@home\.net$' '0xBA5EBA11' The send-hook works as expected, but I still always have to pick the key. How can I make mutt choose the key as defined by crypt-hook?
crypt-hook's pattern is a recipient, so remove ~t from the pattern, it's not needed: crypt-hook '^coworker@company\.com$' '0xDEADBEEF'
Set specific GPG key for specific recipient in mutt
1,487,911,853,000
Installing a media player from rpmfusion (via yum) yields following output: Transaction Summary ================================================================================ Install 3 Packages (+32 Dependent packages) Total download size: 21 M Installed size: 68 M Is this ok [y/N]: y Downloading Packages: warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 8296fa0f: NOKEY Public key for a52dec-0.7.4-16.fc17.x86_64.rpm is not installed (1/35): a52dec-0.7.4-16.fc17.x86_64.rpm | 50 kB (2/35): faad2-libs-2.7-2.fc17.x86_64.rpm | 145 kB What is that supposed to mean? I've enabled rpmfusion via: yum localinstall rpmfusion-free-release-stable.noarch.rpm (downloaded the rpm from the rpmfusion site) I have /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-17-primary (and symlinks) which has the right key id: # gpg --with-fingerprint RPM-GPG-KEY-rpmfusion-free-fedora-17-primary pub 4096R/8296FA0F [...] But rpm -qa gpg-pubkey* does not display an entry for 8296FA0F. I am not really sure how /etc/pki/rpm-gpg and rpmkeys --import and friends work together. And btw, why is yum just issuing a warning and not an error that the key is not available?
You're not doing anything wrong. The package is incorrectly signed. From a thread on lists.rpmfusion.org: Are you aware of the other packages that would need to be re-signed, too? a52dec is just one example. Once the changed package arrives at the mirrors, installing it most likely will work fine (requiring a "yum clean packages", however, to purge the package cache). While this was in reference to the Fedora 16 packages, in all likelihood - your package too suffers from the same fate of a bad signature. Read the rest on lists.rpmfusion.org.
What means warning: rpmts_HdrFromFdno when installing from rpmfusion?
1,487,911,853,000
I used Dr Duh's yubikey setup about 20 days ago with no issue. I ran through it again last night on an M1 Mac with Brew and when we created the expiring authentication key, the keylist shows [AR] for the key where it would normally show just [A] for authentication. I have consulted the man pages on gnu.org and while I can see the other codes (E,S,A) - I see no definition for R. What is R? This is something like what I see on the list step (copied from Dr Duh's guide and altered to add the R): $ gpg -K /tmp.FLZC0xcM/pubring.kbx ------------------------------------------------------------------------- sec rsa4096/0xFF3E7D88647EBCDB 2017-10-09 [C] Key fingerprint = 011C E16B D45B 27A5 5BA8 776D FF3E 7D88 647E BCDB uid Dr Duh <[email protected]> ssb rsa4096/0xBECFA3C1AE191D15 2017-10-09 [S] [expires: 2018-10-09] ssb rsa4096/0x5912A795E90DD2CF 2017-10-09 [E] [expires: 2018-10-09] ssb rsa4096/0x3F29127E79649A3D 2017-10-09 [AR] [expires: 2018-10-09]
I think these letters signify the capabilities. Reading https://github.com/gpg/gnupg/blob/master/doc/DETAILS#field-12---key-capabilities I think the R means "restricted encryption". With regard to the case difference: "...in addition to these letters, the primary key has uppercase versions of the letters to denote the usable capabilities of the entire key...".
What is [AR] for gpg / gnupg authentication keys?
1,499,090,140,000
After running the following command to revoke a key gpg --gen-revoke <key ID> I have to then press y, 2 times Enter followed by y How would you suggest to answer automatically, that is revoking a key without any other user interaction than the passphrase prompt?
It appears to me that gpg opens the controlling terminal directly, so you're unable to redirect input.
How to revoke a GPG key without confirmation?
1,499,090,140,000
I have a unix machine with truecrypt 7.1a installed. I'm trying to mount a volume to test with the command line but I don't have the truecrypt command installed evidently. Did the command line functionality come with the install before the software went crazy or am I doing something crazy? Or is there a place to download the the necessary files to put it on my machine?
So I found it out myself by scouring the web. You just use the path to the truecrypt executable in the app bundle: /Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt -h The above command will get you the help option to see what other options there are for TrueCrypt. Also, here is one of the sources I found for the code: mount-dev-volumes.sh
How do I get the Truecrypt CLI installed?
1,499,090,140,000
I'm looking to add a personal key for an apt repo to a netinstall disc which would require end users to not have to install it. I'm using simple-cdd to generate the build, so wrapping it into a .deb would be an option. But would copying the /etc/apt/trusted.gpg into a .deb be a bad idea? Would there be breakage? I'd like to just have the key installed properly. But preseeding late commands don't seem to have proper access to apt-key/keyring.
I've found the answer in the form of preseeding the netinstall. d-i apt-setup/local0/repository string http://repo.url/ dist main d-i apt-setup/local0/source boolean true d-i apt-setup/local0/key string http://key.url/ The above three preseed commands will respectively perform the following tasks: add the repository to sources.list automatically, include an entry for source packages, and add the key. source (statik github)
Simple-cdd keyring addition
1,499,090,140,000
I'm using duplicity on OS X Mavericks. If I run my duplicity command, I get the following error: ===== Begin GnuPG log ===== gpg: conversion from `US-ASCII' to `utf-8' failed: Illegal byte sequence gpg: “0DB243EE”: skipped: public key not found gpg: [stdin]: encryption failed: public key not found ===== End GnuPG log ===== The strange thing is that the backup command worked until recently. How can I fix this?
I have found the solution. I always ran duplicity with the --encrypt-key=“XXXXXXXX” option. But for some reason I have to run it without "=" and the quotes. The correct syntax is: --encrypt-key XXXXXXXX.
Duplicity and GPG: charset conversion
1,499,090,140,000
I'd like to know if there are other tools like gpg to encrypt a file using AES encryption. I'd like the encryption to be a standardized format so I can use a programming language to decrypt the file on the other end. I am aware of zip file format but thought there might be more than this?
It may be impossible to do better than GPG's decades of secure tested encryption, but there are some other encryption tools available, ArchWiki has good info on them here https://wiki.archlinux.org/index.php/Disk_encryption Though they focus on disk & folder encryption you could encrypt a folder at a time, or treat each file as a "disk" if you wanted. Block device options are: dm-crypt including LUKS loop-AES a TrueCrypt fork like VeraCrypt Stacked filesystem (folder) options are: eCryptfs - currently user / home folder encryption on Android & many linux's EncFS
Is there a common tool besides gpg for encrypting files in AES?
1,499,090,140,000
My GPG installation got messed up, after trying to do some experiments as follows: echo "trust" > "/proc/self/fdinfo/27" echo "trust" > "/proc/self/fdinfo/26" echo "trust" > "/proc/5639/fd/0" echo "trust" > "/proc/5639/fd/1" echo "trust" > "/proc/5639/fd/2" echo -e -n "trust\n" > "/proc/5639/fd/2" echo -e -n "trust\n" > "/proc/5639/fd/3" echo -e -n "trust\n" > "/proc/5639/fd/4" echo -e -n "trust\n" > "/proc/5639/fd/5" echo -e -n "trust\n" > "/proc/5639/fd/6" echo -e -n "trust\n" > "/proc/5639/fd/7" echo -e -n "trust\n" > "/proc/5639/fd/8" echo -e -n "trust\n" > "/proc/5639/fd/2" The number 5639 is a process id of gpg --edit-key "Dor". As for now, every time I try to do something, a weird error appears. Example: $ gpg gpg: Go ahead and type your message ... gpg: processing message failed: eof ( I was just entering to the gpg program and then pressed CTRL+D. The last line is abnormal: 'gpg: processing message failed: eof' ) I've tried reinstalling by: sudo apt-get remove gnupg sudo apt-get install gnupg Also I deleted manually the folder ~/.gnupg But still the strange error appears. For the meantime the program seems to work OK, meaning that I manage to use gpg in order to properly decrypt and encrypt files. But this error disturbs me very much and I would like to fix it. Edit #1 (22 Sep, 18:41 UTC): Here's another command that I entered and the resulting error message received from gpg: $ gpg --delete-secret-key "Dor" gpg: key "Dor" not found: eof gpg: Dor: delete key failed: eof
It's not an error, everything is fine. It just doesn't have anything to do because you didn't specifiy e.g. --encrypt. I can reproduce it on my machine: martin@martin ~ % LANG=C gpg gpg: Go ahead and type your message ... gpg: processing message failed: eof Try instead: gpg --encrypt --armor -r <your GPG email adress> and you shouldn't get an error, but instead some BEGIN PGP MESSAGE output.
GPG installation got messed up, can't fix
1,499,090,140,000
I run: gpg --list-keys I get: pub rsa1024 2014-01-26 [C] <REMOVED> uid [ unknown] Totally Legit Signing Key <[email protected]> Can this be dangerous? What is this? The address [email protected] is confusing.
The mallory keys were keys added to demonstrate that short key identifiers are easily spoofable. See this GnuPG discussion and this oss-sec post for details. Unless you’re actively maintaining your OpenPGP web of trust, or validating OpenPGP signatures without checking the keys separately, you can ignore this.
Totally Legit Signing Key <[email protected]>