Commit 3af8d646 authored by Allen Winter's avatar Allen Winter
Browse files

Move the kpgp library back to kdepim from kdepimlibs.

svn path=/trunk/KDE/kdepim/libkpgp/; revision=684900
parent 818d60ae
......@@ -101,6 +101,9 @@ endif(GPGME_FOUND)
if(GPGME_FOUND)
add_subdirectory(kleopatra)
endif(GPGME_FOUND)
if(NOT WIN32)
add_subdirectory(libkpgp)
endif(NOT WIN32)
add_subdirectory(libksieve)
add_subdirectory(mimelib)
......
......@@ -38,6 +38,7 @@ libkdepim Marc Mutz <mutz@kde.org>
Don Sanders <sanders@kde.org> (maillistdrag)
libkholidays Allen Winter <winter@kde.org>
libkleo Marc Mutz <mutz@kde.org>
libkpgp Ingo Klöcker <kloecker@kde.org>
libksieve Marc Mutz <mutz@kde.org>
mimelib ?
networkstatus Will Stephenson <lists@stevello.free-online.co.uk>
......
......@@ -62,6 +62,9 @@
* - <a href="libkholidays/html/index.html"><b>libkholidays</b></a>
* (<a href="libkholidays/html/classes.html">classes</a>)\n
* <i>A library for handling holidays.</i>
* - <a href="kpgp/html/index.html"><b>kpgp</b></a>
* (<a href="libkpgp/html/classes.html">classes</a>)\n
* <i>Library for kpgp.</i>
* - <a href="libkleo/html/index.html"><b>libkleo</b></a>
* (<a href="libkleo/html/classes.html">classes</a>)\n
* <i>A library for encryption handling.</i>
......
......@@ -42,6 +42,7 @@ There is also quite an amount of infrastructure in this package:
* libkdenetwork: Common code for apps previously being in the kdenetwork CVS
module (KMail, KNode). This will be merged with libkdepim.
* mimelib: MIME messages library
* kpgp: A library for pgp
* libkpimexchange: connecting to Exchange2000 servers
* kdgantt: alternative lib for Gantt diagrams, used by the free/busy view of
KOrganizer (yes, we should decide for one of the Gantt libs)
......
......@@ -215,7 +215,7 @@ kde4_add_kcfg_files(kmailprivate_LIB_SRCS globalsettings_base.kcfgc replyphrases
kde4_add_library(kmailprivate SHARED ${kmailprivate_LIB_SRCS})
target_link_libraries(kmailprivate ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KHTML_LIBRARY} ${KDE4_THREADWEAVER_LIBRARIES} ${KDE4_KMIME_LIBS} ${KDE4_KPGP_LIBS} ${KDE4_KPIMIDENTITIES_LIBS} ${KDE4_KCAL_LIBS} ${KDE4_PHONON_LIBS} ${KDE4_KNOTIFYCONFIG_LIBRARY} ${KDE4_KTNEF_LIBS} ${KDE4_KUTILS_LIBRARY} ${KDE4_MAILTRANSPORT_LIBS} ${KDE4_KIMAP_LIBS} kdepim mimelib ksieve kleopatra)
target_link_libraries(kmailprivate ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KHTML_LIBRARY} ${KDE4_THREADWEAVER_LIBRARIES} ${KDE4_KMIME_LIBS} ${KDE4_KPIMIDENTITIES_LIBS} ${KDE4_KCAL_LIBS} ${KDE4_PHONON_LIBS} ${KDE4_KNOTIFYCONFIG_LIBRARY} ${KDE4_KTNEF_LIBS} ${KDE4_KUTILS_LIBRARY} ${KDE4_MAILTRANSPORT_LIBS} ${KDE4_KIMAP_LIBS} kdepim mimelib ksieve kpgp kleopatra)
set_target_properties(kmailprivate PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
install(TARGETS kmailprivate DESTINATION ${LIB_INSTALL_DIR})
......
......@@ -41,7 +41,7 @@
#include <kleo/enum.h>
#include <kpgp/kpgp.h> // for Kpgp::Result
#include <libkpgp/kpgp.h> // for Kpgp::Result
#include <gpgmepp/key.h>
#include <vector>
......
......@@ -29,7 +29,7 @@
#include "kmreadermainwin.h"
#include "messagesender.h"
#include "kmmsgpartdlg.h"
#include <kpgp/kpgpblock.h>
#include <libkpgp/kpgpblock.h>
#include <kaddrbook.h>
#include "kmaddrbook.h"
#include "kmmsgdict.h"
......
......@@ -60,7 +60,7 @@ using KMail::TemplateParser;
#include <kapplication.h>
#include <ksystemtrayicon.h>
#include <kconfiggroup.h>
#include <kpgp/kpgp.h>
#include <libkpgp/kpgp.h>
#include <kdebug.h>
#include <kio/netaccess.h>
#include <kwallet.h>
......
......@@ -31,7 +31,7 @@ using KMail::TemplateParser;
#include <kpimutils/email.h>
#include <cryptplugwrapperlist.h>
#include <kpgp/kpgpblock.h>
#include <libkpgp/kpgpblock.h>
#include <kaddrbook.h>
#include <kglobal.h>
......
......@@ -74,7 +74,7 @@
#include <kmime/kmime_util.h>
#include <kmime/kmime_codecs.h>
#include <kpgp/kpgpblock.h>
#include <libkpgp/kpgpblock.h>
#include <kconfiggroup.h>
#include <kmessagebox.h>
#include <klocale.h>
......
......@@ -41,7 +41,7 @@
#include <mimelib/mediatyp.h>
#include <kleo/cryptobackend.h>
#include <kpgp/kpgp.h>
#include <libkpgp/kpgp.h>
#include <vector>
......
......@@ -65,8 +65,8 @@
#include <gpgmepp/importresult.h>
#include <kpgp/kpgpblock.h>
#include <kpgp/kpgp.h>
#include <libkpgp/kpgpblock.h>
#include <libkpgp/kpgp.h>
#include <kpimutils/linklocator.h>
using KPIMUtils::LinkLocator;
......
......@@ -19,7 +19,7 @@
#include <cryptplugwrapper.h>
#include <kpgp/kpgp.h>
#include <libkpgp/kpgp.h>
#include <QString>
#include <time.h>
......
......@@ -80,7 +80,7 @@ kde4_add_kcfg_files(knodecommon_LIB_SRCS settings_base.kcfgc )
kde4_add_library(knodecommon SHARED ${knodecommon_LIB_SRCS})
target_link_libraries(knodecommon ${KDE4_KDEPRINT_LIBS} ${KDE4_KMIME_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4_KHTML_LIBS} ${KDE4_KPIMUTILS_LIBS} ${KDE4_MAILTRANSPORT_LIBS} ${KDE4_KPGP_LIBS} kdepim)
target_link_libraries(knodecommon ${KDE4_KDEPRINT_LIBS} ${KDE4_KMIME_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4_KHTML_LIBS} ${KDE4_KPIMUTILS_LIBS} ${KDE4_MAILTRANSPORT_LIBS} kpgp kdepim)
set_target_properties(knodecommon PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
install(TARGETS knodecommon DESTINATION ${LIB_INSTALL_DIR})
......
......@@ -51,8 +51,8 @@
#include <kxmlguifactory.h>
#include <kicon.h>
#include <kpgp/kpgp.h>
#include <kpgp/kpgpblock.h>
#include <libkpgp/kpgp.h>
#include <libkpgp/kpgpblock.h>
#include <libkdepim/kxface.h>
#include <kpimutils/kfileio.h>
......
......@@ -50,8 +50,8 @@ using KRecentAddress::RecentAddresses;
#include <kcombobox.h>
#include <k3spell.h>
#include <ktemporaryfile.h>
#include <kpgp/kpgp.h>
#include <kpgp/kpgpblock.h>
#include <libkpgp/kpgp.h>
#include <libkpgp/kpgpblock.h>
#include <k3process.h>
#include <k3syntaxhighlighter.h>
#include <QCursor>
......
......@@ -35,8 +35,8 @@
#include <k3spell.h>
#include <k3sconfig.h>
#include <kcombobox.h>
#include <kpgp/kpgp.h>
#include <kpgp/kpgpui.h>
#include <libkpgp/kpgp.h>
#include <libkpgp/kpgpui.h>
#include <kurlcompletion.h>
#include <kiconloader.h>
#include <kpushbutton.h>
......
......@@ -76,7 +76,7 @@ using MailTransport::TransportManager;
#include "kncleanup.h"
#include "utilities.h"
#include "knscoring.h"
#include <kpgp/kpgp.h>
#include <libkpgp/kpgp.h>
#include "knmemorymanager.h"
#include "scheduler.h"
#include "settings.h"
......
Program: kpgp
Lars Knoll <knoll@mpi-hd.mpg.de>
- Original version, PGP2 and PGP5 support
"J. Nick Koston" <bdraco@the.system.is.halted.net>
- GnuPG support
Andreas Gungl <a.gungl@gmx.de>
- PGP6 and other enhancements
Ingo Klöcker <ingo.kloecker@epost.de>
- KpgpKey and other enhancements
......@@ -19,12 +19,12 @@ set(kpgp_LIB_SRCS
kde4_automoc(${kpgp_LIB_SRCS})
kde4_add_library(kpgp-gpl SHARED ${kpgp_LIB_SRCS})
kde4_add_library(kpgp SHARED ${kpgp_LIB_SRCS})
target_link_libraries(kpgp-gpl ${KDE4_KDE3SUPPORT_LIBS} )
target_link_libraries(kpgp ${KDE4_KDE3SUPPORT_LIBS} )
set_target_properties(kpgp-gpl PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
install(TARGETS kpgp-gpl DESTINATION ${LIB_INSTALL_DIR})
set_target_properties(kpgp PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
install(TARGETS kpgp DESTINATION ${LIB_INSTALL_DIR})
########### install files ###############
......
// DOXYGEN_REFERENCES = kdecore kdeui
#! /bin/sh
$XGETTEXT *.cpp *.h -o $podir/libkpgp.pot
pgp abstraction layer
Maintainer: Ingo Klöcker <ingo.kloecker@epost.de>
License: GPL
#!/usr/bin/perl
# Read all "AddressKeyEntry #" groups and the "EncryptionPreferences" group
# and store the information together in new "Address #" groups
my %data;
$currentGroup = "";
$address = "";
while(<>) {
next if /^$/;
# filter out groups:
if( /^\[(.+)\]$/ ) {
$currentGroup = $1;
# delete the obsolete groups
if( ( $currentGroup =~ /^AddressKeyEntry \d*/ ) ||
( $currentGroup eq "EncryptionPreferences" ) ) {
print "# DELETEGROUP [$currentGroup]\n";
}
next;
}
# store the values of the old groups and delete them
if( $currentGroup =~ /^AddressKeyEntry \d*/ ) {
if( /^Address=(.*)$/ ) {
$address = $1;
}
elsif( /^Key ID=(.*)$/ ) {
$data{$address}{"keyid"} = $1;
}
}
elsif( $currentGroup eq "EncryptionPreferences" ) {
($address,$encrpref) = split /=/;
chomp $encrpref;
$data{$address}{"encrpref"} = $encrpref;
}
}
# write the new address groups
$n = 1;
foreach $address ( keys %data ) {
%addressData = %{$data{$address}};
print "[Address #$n]\n";
print "Address=$address\n";
if( exists $addressData{"encrpref"} ) {
$encrpref = $addressData{"encrpref"};
print "EncryptionPreference=$encrpref\n";
}
if( exists $addressData{"keyid"} ) {
$keyid = $addressData{"keyid"};
print "Key IDs=$keyid\n";
}
$n++;
}
$n--;
# write the number of address groups
print "# DELETE [General]addressKeyEntries\n";
print "# DELETE [General]addressEntries\n";
print "[General]\naddressEntries=$n\n";
# Remove the old Encryption Preferences (applies only to KDE3 Beta users)
Id=preKDE3_a
File=kpgprc
RemoveGroup=EncryptionPreferences
# new format for storing info about encryption keys and encryption preferences
# for email addresses (in kpgprc)
Id=3.1-1
File=kpgprc
Script=kpgp-3.1-upgrade-address-data.pl,perl
This diff is collapsed.
/*
kpgpblock.cpp
Copyright (C) 2001,2002 the KPGP authors
See file AUTHORS.kpgp for details
This file is part of KPGP, the KDE PGP/GnuPG support library.
KPGP is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "kpgpblock.h"
#include "kpgp.h"
#include <QString>
#include <QByteArray>
namespace Kpgp {
Block::Block( const QByteArray& str )
: mText(str), mProcessedText(), mError(),
mSignatureUserId(), mSignatureKeyId(), mSignatureDate(),
mRequiredKey(), mEncryptedFor(),
mStatus(0), mHasBeenProcessed(false), mType(NoPgpBlock)
{
}
Block::~Block()
{
}
void
Block::reset()
{
mProcessedText = QByteArray();
mError = QByteArray();
mSignatureUserId.clear();
mSignatureKeyId = QByteArray();
mSignatureDate = QByteArray();
mRequiredKey = QByteArray();
mEncryptedFor.clear();
mStatus = 0;
mHasBeenProcessed = false;
}
void
Block::clear()
{
reset();
mText = QByteArray();
mType = NoPgpBlock;
}
BlockType
Block::determineType() const
{
if( !strncmp( mText.data(), "-----BEGIN PGP ", 15 ) )
{
if( !strncmp( mText.data() + 15, "SIGNED", 6 ) )
return ClearsignedBlock;
else if( !strncmp( mText.data() + 15, "SIGNATURE", 9 ) )
return SignatureBlock;
else if( !strncmp( mText.data() + 15, "PUBLIC", 6 ) )
return PublicKeyBlock;
else if( !strncmp( mText.data() + 15, "PRIVATE", 7 ) ||
!strncmp( mText.data() + 15, "SECRET", 6 ) )
return PrivateKeyBlock;
else if( !strncmp( mText.data() + 15, "MESSAGE", 7 ) )
{
if( !strncmp( mText.data() + 22, ", PART", 6 ) )
return MultiPgpMessageBlock;
else
return PgpMessageBlock;
}
else if( !strncmp( mText.data() + 15, "ARMORED FILE", 12 ) )
return PgpMessageBlock;
else
return UnknownBlock;
}
else
return NoPgpBlock;
}
bool
Block::decrypt()
{
Kpgp::Module *pgp = Kpgp::Module::getKpgp();
if( pgp == 0 )
return false;
return pgp->decrypt( *this );
}
bool
Block::verify()
{
Kpgp::Module *pgp = Kpgp::Module::getKpgp();
if( pgp == 0 )
return false;
return pgp->verify( *this );
}
Kpgp::Result
Block::clearsign( const QByteArray& keyId, const QByteArray& charset )
{
Kpgp::Module *pgp = Kpgp::Module::getKpgp();
if( pgp == 0 )
return Kpgp::Failure;
return pgp->clearsign( *this, keyId, charset );
}
Kpgp::Result
Block::encrypt( const QStringList& receivers, const QByteArray& keyId,
const bool sign, const QByteArray& charset )
{
Kpgp::Module *pgp = Kpgp::Module::getKpgp();
if( pgp == 0 )
return Kpgp::Failure;
return pgp->encrypt( *this, receivers, keyId, sign, charset );
}
} // namespace Kpgp
......@@ -128,7 +128,7 @@ class KPGP_EXPORT Block
/** shows the secret key which is needed
to decrypt the message */
QString requiredKey() const;
QByteArray requiredKey() const;
void setRequiredKey( const QByteArray& keyId );
QString requiredUserId() const;
......@@ -277,7 +277,7 @@ Block::setSignatureDate( const QByteArray& date )
mSignatureDate = date;
}
inline QString
inline QByteArray
Block::requiredKey() const
{
return mRequiredKey;
......
/*
kpgpkey.cpp
Copyright (C) 2001,2002 the KPGP authors
See file AUTHORS.kpgp for details
This file is part of KPGP, the KDE PGP/GnuPG support library.
KPGP is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "kpgpkey.h"
#include "kdebug.h"
//Added by qt3to4:
#include <QByteArray>
namespace Kpgp {
/* member functions of Kpgp::KeyIDList --------------------------------- */
/** Converts from a KeyIDList to a QStringList.
*/
QStringList KeyIDList::toStringList() const
{
QStringList res;
for( KeyIDList::ConstIterator it = begin(); it != end(); ++it ) {
res << (*it).data();
}
return res;
}
/** Converts from a QStringList to a KeyIDList.
*/
KeyIDList KeyIDList::fromStringList( const QStringList& l )
{
KeyIDList res;
for( QStringList::ConstIterator it = l.begin(); it != l.end(); ++it ) {
res << (*it).toLocal8Bit();
}
return res;
}
/* member functions of Kpgp::UserID ------------------------------------ */
UserID::UserID(const QString& str, const Validity validity,
const bool revoked, const bool invalid)
{
mText = str;
mValidity = validity;
mRevoked = revoked;
mInvalid = invalid;
}
/* member functions of Kpgp::Subkey ------------------------------------ */
Subkey::Subkey(const KeyID& keyID, const bool secret)
{
mSecret = secret;
mKeyID = keyID;
mRevoked = false;
mExpired = false;
mDisabled = false;
mInvalid = false;
mCanEncrypt = false;
mCanSign = false;
mCanCertify = false;
mKeyAlgo = 0;
mKeyLen = 0;
mFingerprint = 0;
mTimestamp = 0;
mExpiration = 0;
}
/* member functions of Kpgp::Key --------------------------------------- */
Key::Key(const KeyID& keyid, const QString& uid, const bool secret) :
mSubkeys(), mUserIDs()
{
mSecret = secret;
if (!keyid.isEmpty())
addSubkey(keyid, secret);
if (!uid.isEmpty())
addUserID(uid);
mRevoked = false;
mExpired = false;
mDisabled = false;
mInvalid = false;
mCanEncrypt = false;
mCanSign = false;
mCanCertify = false;
mEncryptPref = UnknownEncryptPref;
}
Key::~Key()
{
//kDebug( 5326 ) << "Kpgp::Key: Deleting key " << primaryUserID() << endl;
mUserIDs.setAutoDelete(true);
mUserIDs.clear();
mSubkeys.setAutoDelete(true);
mSubkeys.clear();
}
void
Key::clear()
{
mSecret = false;
mRevoked = false;
mExpired = false;
mDisabled = false;
mInvalid = false;
mCanEncrypt = false;
mCanSign = false;
mCanCertify = false;
mEncryptPref = UnknownEncryptPref;
mSubkeys.setAutoDelete(true);
mSubkeys.clear();
mUserIDs.setAutoDelete(true);
mUserIDs.clear();
}
Validity
Key::keyTrust() const
{
Validity trust = KPGP_VALIDITY_UNKNOWN;
for( UserIDListIterator it(mUserIDs); it.current(); ++it )
{
if( (*it)->validity() > trust )
trust = (*it)->validity();
}
return trust;
}
Validity
Key::keyTrust( const QString& uid ) const
{
Validity trust = KPGP_VALIDITY_UNKNOWN;
if( uid.isEmpty() )
return trust;
for( UserIDListIterator it(mUserIDs); it.current(); ++it )
{
if( (*it)->text() == uid )