Error at "bag.attributes" importing key from freemail cert into gpgsm

Werner Koch wk at gnupg.org
Wed Apr 20 17:12:21 CEST 2005


On Thu, 7 Apr 2005 16:15:30 -0400, Nicholas Sushkin said:

> gpg-protect-tool: encryptedData error at "bag.attributes", offset 2592
> gpg-protect-tool: error at "bag.encryptedData", offset 49

Thanks for the test data.  It is a plain bug, here is patch:



2005-04-20  Werner Koch  <wk at g10code.com>

	* minip12.c (parse_bag_encrypted_data): Fix the unpadding hack.

diff -u -p -r1.5.2.7 minip12.c
--- agent/minip12.c     29 Sep 2004 13:50:31 -0000      1.5.2.7
+++ agent/minip12.c     20 Apr 2005 15:18:31 -0000
@@ -587,7 +588,7 @@ parse_bag_encrypted_data (const unsigned
 
       /* Ugly hack to cope with the padding: Forget about the rest if
          that it is less than the cipher's block length. */
-      if (n < 8)
+      if (n <= 8)
         n = 0;  
 
       /* Skip the optional SET with the pkcs12 cert attributes. */
@@ -602,7 +603,7 @@ parse_bag_encrypted_data (const unsigned
             { /* The optional SET. */
               p += ti.length;
               n -= ti.length;
-              if (n < 8)
+              if (n <= 8)
                 n = 0;
               if (n && parse_tag (&p, &n, &ti))
                 goto bailout;




More information about the Gnupg-users mailing list