diff options
author | Werner Koch <wk@gnupg.org> | 2007-08-22 12:55:07 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2007-08-22 12:55:07 +0200 |
commit | f81f521a72ccbccf2b66c4b7ce96021de90c9e29 (patch) | |
tree | d5335291ab12819087ea12e250cbf4241c703749 /agent | |
parent | Post release version number bump (diff) | |
download | gnupg2-f81f521a72ccbccf2b66c4b7ce96021de90c9e29.tar.xz gnupg2-f81f521a72ccbccf2b66c4b7ce96021de90c9e29.zip |
Updated estream.
More changes for Windows.
Diffstat (limited to 'agent')
-rw-r--r-- | agent/ChangeLog | 5 | ||||
-rw-r--r-- | agent/protect-tool.c | 19 |
2 files changed, 22 insertions, 2 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog index dac47fdc1..78b4871bb 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,8 @@ +2007-08-22 Werner Koch <wk@g10code.com> + + * protect-tool.c (import_p12_file): Add hack to allow importing of + gnupg 2.0.4 generated files. + 2007-08-06 Werner Koch <wk@g10code.com> * trustlist.c (read_one_trustfile): Add flag "cm". diff --git a/agent/protect-tool.c b/agent/protect-tool.c index 08a446aef..b12b3809d 100644 --- a/agent/protect-tool.c +++ b/agent/protect-tool.c @@ -638,7 +638,7 @@ import_p12_file (const char *fname) { char *buf; unsigned char *result; - size_t buflen, resultlen; + size_t buflen, resultlen, buf_off; int i; int rc; gcry_mpi_t *kparms; @@ -654,7 +654,22 @@ import_p12_file (const char *fname) if (!buf) return; - kparms = p12_parse ((unsigned char*)buf, buflen, (pw=get_passphrase (2, 0)), + /* GnuPG 2.0.4 accidently created binary P12 files with the string + "The passphrase is %s encoded.\n\n" prepended to the ASN.1 data. + We fix that here. */ + if (buflen > 29 && !memcmp (buf, "The passphrase is ", 18)) + { + for (buf_off=18; buf_off < buflen && buf[buf_off] != '\n'; buf_off++) + ; + buf_off++; + if (buf_off < buflen && buf[buf_off] == '\n') + buf_off++; + } + else + buf_off = 0; + + kparms = p12_parse ((unsigned char*)buf+buf_off, buflen-buf_off, + (pw=get_passphrase (2, 0)), import_p12_cert_cb, NULL); release_passphrase (pw); xfree (buf); |