summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libkpgp/kpgpbaseG.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/libkpgp/kpgpbaseG.cpp b/libkpgp/kpgpbaseG.cpp
index 7e96b4e93..cd6eaf41c 100644
--- a/libkpgp/kpgpbaseG.cpp
+++ b/libkpgp/kpgpbaseG.cpp
@@ -313,8 +313,24 @@ BaseG::decrypt( Block& block, const char *passphrase )
index2 = error.find("using", index+15);
block.setSignatureDate( error.mid(index+15, index2-(index+15)-1) );
kdDebug(5100) << "Message was signed on '" << block.signatureDate() << "'\n";
- index2 = error.find("key ID ", index2) + 7;
- block.setSignatureKeyId( error.mid(index2,8) );
+ // To handle gnupg > 2.1
+ // gpg: Signature made Thu 05 Apr 2018 10:02:50 PM CEST
+ // gpg: using DSA key A0CF1DC09533E5E87F54DB40F1EEB8CD9FB16A50
+ // gpg: Good signature from "deloptes <deloptes@gmail.com>" [ultimate]
+ // so we need extra check
+ if (error.contains("key ID") > 0) {
+ index2 = error.find("key ID ", index2) + 7;
+ block.setSignatureKeyId( error.mid(index2,8) );
+ }
+ else {
+ index2 = error.find("key ", index2) + 4;
+ // handle variable key size
+ // gpg: Signature made Mon 02 Apr 2018 03:15:08 PM CEST
+ // gpg: using DSA key 05C82CF57AD1DA46
+ // gpg: Can't check signature: No public key
+ int end = error.find("\n", index2);
+ block.setSignatureKeyId( error.mid(index2,end-index2) );
+ }
kdDebug(5100) << "Message was signed with key '" << block.signatureKeyId() << "'\n";
// move index to start of next line
index = error.find('\n', index2)+1;
@@ -333,7 +349,7 @@ BaseG::decrypt( Block& block, const char *passphrase )
index = error.find('"',index);
index2 = error.find('\n',index+1);
index2 = error.findRev('"', index2-1);
- block.setSignatureUserId( error.mid( index+1, index2-index-1 ) );
+ block.setSignatureUserId( TQString::fromLocal8Bit( error.mid( index+1, index2-index-1 ) ) );
}
else if( error.find("BAD signature", index) != -1 )
{
@@ -343,7 +359,7 @@ BaseG::decrypt( Block& block, const char *passphrase )
index = error.find('"',index);
index2 = error.find('\n',index+1);
index2 = error.findRev('"', index2-1);
- block.setSignatureUserId( error.mid( index+1, index2-index-1 ) );
+ block.setSignatureUserId( TQString::fromLocal8Bit( error.mid( index+1, index2-index-1 ) ) );
}
else if( error.find("Can't find the right public key", index) != -1 )
{