Le problème est du à l'usage d'une clef de chiffrement trop grande (16k au lieu de 4k)
$ LANG=C gpg --decrypt data.enc
gpg: encrypted with 16384-bit ELG key, ID 0xFF2019364801196D, created 2014-10-11
"Jean-Baptiste DUPOND <root@acme.fr>"
gpg: public key decryption failed: Too much data for IPC layer
gpg: decryption failed: No secret key
Il vaut mieux utiliser des clefs de taille standard à moins de savoir vraiment ce que vous faites.
Souvent le mieux est l'ennemie du bien
Problèmes liés au fait d'avoir une clef trop grande :
Cela dit le problème se pose ici pour déchiffrer. Je n'ai jamais rencontré de problème pour chiffrer avec des sous-clef de 16k et une clef primaire de taille normale.
La solution ici https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1445684.html
Il suffit de rechercher les fichiers command.c et de changer
diff --git a/agent/command.c b/agent/command.c index 7fc28ad..9522f89 100644 --- a/agent/command.c +++ b/agent/command.c @@ -49,7 +49,7 @@ /* Maximum allowed size of the key parameters. */ #define MAXLEN_KEYPARAM 1024 /* Maximum allowed size of key data as used in inquiries (bytes). */ -#define MAXLEN_KEYDATA 4096 +#define MAXLEN_KEYDATA 8192 /* The size of the import/export KEK key (in bytes). */ #define KEYWRAP_KEYSIZE (128/8)
Sous Debian
apt-get source gpg sudo apt-get build-dep
Pour contruire un paquet Debian voir https://saveriomiroddi.github.io/Building-a-debian-deb-source-package-and-publishing-it-on-an-ubuntu-ppa/
dpkg-buildpackage -rfakeroot -b -uc -us
Ou
debuild -b -uc -us
gpg --gen-key
Erreur
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: agent_genkey failed: Permission denied Key generation failed: Permission denied
$ ls -l $(tty) crw------- 1 root tty 136, 0 Mar 30 15:59 /dev/pts/0
Solution :
# export GPG_TTY=$(tty) # sudo chown MonUser /dev/pts/0 sudo chown $(whoami) $(tty)
gpg --gen-key
Real name: aaaaaa
Email address: aaa
Not a valid email address
Email address: aaa@localhost
Comment:
You selected this USER-ID:
"aaaaaa <aaa@localhost>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
gpg: cancelled by user
gpg: Key generation canceled.
chmod o+rw $(tty) # ou script /dev/null
ou
dnf install pinentry mkdir ~/.gnupg -m 700 echo "pinentry-program /usr/bin/pinentry-curses" >> ~/.gnupg/gpg-agent.conf
$ gpg --decrypt --pinentry-mode=loopback example.gpg
Normalement l'opération de chiffrement et de signature peut être réalisé en une fois. Mais à cause de ma clef de 16k, ça bug
$ gpg -r jean@acme.fr --sign --encrypt data.dat gpg: out of secure memory while allocating 4096 bytes gpg: (this may be caused by too many secret keys used simultaneously or due to excessive large key sizes)
sudo apt-get build-dep gnupg apt-get source gnupg cd ~/gnupg-1.4.18 ./configure --enable-large-secmem
Voir :