From f81f521a72ccbccf2b66c4b7ce96021de90c9e29 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 22 Aug 2007 10:55:07 +0000 Subject: Updated estream. More changes for Windows. --- agent/ChangeLog | 5 +++++ agent/protect-tool.c | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'agent') 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 + + * protect-tool.c (import_p12_file): Add hack to allow importing of + gnupg 2.0.4 generated files. + 2007-08-06 Werner Koch * 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); -- cgit v1.2.3