View Issue Details

IDProjectCategoryView StatusLast Update
0000148fileGeneralpublic2020-03-20 17:13
Reporterhlein Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformamd64OSLinux 
Product Version5.38 
Fixed in Version5.39 
Summary0000148: PGP magic does not recognize files encrypted to Elgamal or ECC keys
Description...Long submission that took hours to write eaten by Mantis.

tl;drewrite: file does not recognize files encrypted with Elgamal keys (the default for old-fashioned DSA sign-only keys).

I'll attach a patch that makes file properly recognize files encrypted to Elgamal keys, for example:

$ file elg*
elg1024.pgp: PGP Elgamal encrypted session key - keyid: 833B4548 8802A9A6 Elgamal Encrypt-Only 1024b.
elg1024_enconly.pgp: PGP Elgamal encrypted session key - keyid: 833B4548 8802A9A6 Elgamal Encrypt-Only 1024b.
elg2048.pgp: PGP Elgamal encrypted session key - keyid: 12AFCC09 B6C9040B Elgamal Encrypt-Only 2048b.
elg2048_enconly.pgp: PGP Elgamal encrypted session key - keyid: 12AFCC09 B6C9040B Elgamal Encrypt-Only 2048b.
elg3072.pgp: PGP Elgamal encrypted session key - keyid: 213768B7 E0AC80E4 Elgamal Encrypt-Only 3072b.
elg3072_enconly.pgp: PGP Elgamal encrypted session key - keyid: 213768B7 E0AC80E4 Elgamal Encrypt-Only 3072b.
Additional InformationThis is on top of the other patches to magic/Magdir/pgp I've submitted, although for once there might not actually be any overlap/collision.
TagsNo tags attached.

Activities

hlein

2020-02-23 05:09

reporter  

file-magic-pgp-elgamal.diff (1,300 bytes)   
--- magic/Magdir/pgp.orig	2020-02-21 18:38:58.661288076 -0500
+++ magic/Magdir/pgp	2020-02-22 22:02:37.560177451 -0500
@@ -209,6 +209,51 @@
 >13	string	\x1f\xf9
 >1039	byte	0xd2			.
 
+# 1024b Elgamal encrypted data
+
+0	string	\x85\x01\x0e\x03	PGP Elgamal encrypted session key -
+>4	belong	x			keyid: %08X
+>8	belong	x			%08X
+>12	byte	0x10			Elgamal Encrypt-Only 1024b.
+>13	string	\x04\x00
+>13	string	\x03\xff
+>13	string	\x03\xfe
+>13	string	\x03\xfd
+>13	string	\x03\xfc
+>13	string	\x03\xfb
+>13	string	\x03\xfa
+>13	string	\x03\xf9
+
+# 2048b Elgamal encrypted data
+
+0	string	\x85\x02\x0e\x03	PGP Elgamal encrypted session key -
+>4	belong	x			keyid: %08X
+>8	belong	x			%08X
+>12	byte	0x10			Elgamal Encrypt-Only 2048b.
+>13	string	\x08\x00
+>13	string	\x07\xff
+>13	string	\x07\xfe
+>13	string	\x07\xfd
+>13	string	\x07\xfc
+>13	string	\x07\xfb
+>13	string	\x07\xfa
+>13	string	\x07\xf9
+
+# 3072b Elgamal encrypted data
+
+0	string	\x85\x03\x0e\x03	PGP Elgamal encrypted session key -
+>4	belong	x			keyid: %08X
+>8	belong	x			%08X
+>12	byte	0x10			Elgamal Encrypt-Only 3072b.
+>13	string	\x0c\x00
+>13	string	\x0b\xff
+>13	string	\x0b\xfe
+>13	string	\x0b\xfd
+>13	string	\x0b\xfc
+>13	string	\x0b\xfb
+>13	string	\x0b\xfa
+>13	string	\x0b\xf9
+
 # crypto algo mapper
 
 0	name	crypto
file-magic-pgp-elgamal.diff (1,300 bytes)   

christos

2020-03-20 17:13

manager   ~0003398

Patch applied, sorry you lost time with mantis... Do you know what's broken with it?

Issue History

Date Modified Username Field Change
2020-02-23 05:09 hlein New Issue
2020-02-23 05:09 hlein File Added: file-magic-pgp-elgamal.diff
2020-03-20 17:11 christos Assigned To => christos
2020-03-20 17:11 christos Status new => assigned
2020-03-20 17:13 christos Status assigned => resolved
2020-03-20 17:13 christos Resolution open => fixed
2020-03-20 17:13 christos Fixed in Version => 5.39
2020-03-20 17:13 christos Note Added: 0003398