--------------Boundary-00=_ZW9UKT0YHATO3893BC5M Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, since the PGP user id depends on the identity encryptToSelf didn't work anymore because the message was encrypted to the no longer existant global PGP user id instead of being encrypted to the identity dependant PGP user id. The attached patch fixes this problem. To solve this problem I had to add a parameter (the PGP user id which should be used) to Kpgp::encryptFor(...) and Kpgp::sign(...). Therefore all programs which depend on libkdenetwork and call Kpgp::encryptFor(...) and Kpgp::sign(...) will have to be adapted. My patch also includes the necessary patch for KMail. I guess KNode will have to be patched in a similar way if it also uses identities. But as I don't know KNode I will leave this to the maintainers of KNode (hi, Mathias). BTW, I also commented out the saving to and loading from kpgprc of pgpUser as there is no longer a global PGP user id. Regards, Ingo -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE7JpuzGnR+RTDgudgRAtsqAKCMZwhlvNlgiqYmpEYu6750F8LQyQCfaYdV +eZcwIHSynygoZoWCjvA+0s= =FEPp -----END PGP SIGNATURE----- --------------Boundary-00=_ZW9UKT0YHATO3893BC5M Content-Type: text/plain; charset="iso-8859-1"; name="libkdenetwork-fix-encryptToSelf-2001-06-13-0015.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="libkdenetwork-fix-encryptToSelf-2001-06-13-0015.diff" Index: kpgp.cpp =================================================================== RCS file: /home/kde/kdenetwork/libkdenetwork/kpgp.cpp,v retrieving revision 1.14 diff -u -3 -p -r1.14 kpgp.cpp --- kpgp.cpp 2001/06/12 12:50:50 1.14 +++ kpgp.cpp 2001/06/12 21:33:59 @@ -93,7 +93,7 @@ Kpgp::readConfig() storePass = config->readBoolEntry("storePass"); showEncryptionResult = config->readBoolEntry("showEncryptionResult", true); pgpType = ( Kpgp::PGPType) config->readNumEntry("pgpType",tAuto); - pgpUser = config->readEntry("user"); + //pgpUser = config->readEntry("user"); flagEncryptToSelf = config->readBoolEntry("encryptToSelf", true); } @@ -103,7 +103,7 @@ Kpgp::writeConfig(bool sync) config->writeEntry("storePass",storePass); config->writeEntry("showEncryptionResult", showEncryptionResult); config->writeEntry("pgpType",(int) pgpType); - config->writeEntry("user",pgpUser); + //config->writeEntry("user",pgpUser); config->writeEntry("encryptToSelf",flagEncryptToSelf); if(sync) @@ -296,13 +298,13 @@ Kpgp::decrypt(void) } bool -Kpgp::sign(void) +Kpgp::sign(QString pgpUserId) { - return encryptFor(0, true); + return encryptFor(0, true, pgpUserId); } bool -Kpgp::encryptFor(const QStrList& aPers, bool sign) +Kpgp::encryptFor(const QStrList& aPers, bool sign, QString pgpUserId) { QStrList persons, noKeyFor; char* pers; @@ -313,6 +315,7 @@ Kpgp::encryptFor(const QStrList& aPers, if (0 == pgp) assignPGPBase(); + setUser(pgpUserId); persons.clear(); noKeyFor.clear(); Index: kpgp.h =================================================================== RCS file: /home/kde/kdenetwork/libkdenetwork/kpgp.h,v retrieving revision 1.5 diff -u -3 -p -r1.5 kpgp.h --- kpgp.h 2001/06/12 12:50:50 1.5 +++ kpgp.h 2001/06/12 21:34:00 @@ -80,14 +80,15 @@ public: returns false otherwise */ bool decrypt(void); /** encrypt the message for a list of persons. */ - bool encryptFor(const QStrList& receivers, bool sign = TRUE); + bool encryptFor(const QStrList& receivers, bool sign = TRUE, + const QString pgpUserId = QString::null); protected: int doEncSign(QStrList persons, bool sign, bool ignoreUntrusted = false); public: /** sign the message. */ - bool sign(void); + bool sign(const QString pgpUserId = QString::null); /** sign a key in the keyring with users signature. */ bool signKey(QString _key); /** get the known public keys. */ --------------Boundary-00=_ZW9UKT0YHATO3893BC5M Content-Type: text/x-c++; charset="iso-8859-1"; name="kmail-fix-encryptToSelf-2001-06-13-0015.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="kmail-fix-encryptToSelf-2001-06-13-0015.diff" Index: kmcomposewin.cpp =================================================================== RCS file: /home/kde/kdenetwork/kmail/kmcomposewin.cpp,v retrieving revision 1.347 diff -u -3 -p -r1.347 kmcomposewin.cpp --- kmcomposewin.cpp 2001/06/12 09:44:13 1.347 +++ kmcomposewin.cpp 2001/06/12 21:33:38 @@ -1251,9 +1251,19 @@ QCString KMComposeWin::pgpProcessedMsg(v pgp->setMessage(cText); + // get PGP user id for the chosen identity + QString pgpUserId; + QString identStr = i18n( "Default" ); + if( !mId.isEmpty() && KMIdentity::identities().contains( mId ) ) { + identStr = mId; + } + KMIdentity ident(identStr); + ident.readConfig(); + pgpUserId = ident.pgpIdentity(); + if (!doEncrypt) { - if(pgp->sign()) return pgp->message(); + if(pgp->sign(pgpUserId)) return pgp->message(); } else { @@ -1274,7 +1284,7 @@ QCString KMComposeWin::pgpProcessedMsg(v } while (lastindex > 0); - if(pgp->encryptFor(persons, doSign)) + if(pgp->encryptFor(persons, doSign, pgpUserId)) return pgp->message(); } --------------Boundary-00=_ZW9UKT0YHATO3893BC5M-- _______________________________________________ Kmail Developers mailing list Kmail@master.kde.org http://master.kde.org/mailman/listinfo/kmail