• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

libkpgp

  • Kpgp
  • Module
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Kpgp::Module Class Reference

#include <kpgp.h>

Public Types

enum  PGPType {
  tAuto, tGPG, tPGP2, tPGP5,
  tPGP6, tOff
}
 

Public Member Functions

virtual ~Module ()
 
bool changePassPhrase ()
 
void clear (const bool erasePassPhrase=false)
 
Kpgp::Result clearsign (Block &block, const KeyID &keyId, const QByteArray &charset=0)
 
bool decrypt (Block &block)
 
Kpgp::Result encrypt (Block &block, const QStringList &receivers, const KeyID &keyId, bool sign, const QByteArray &charset=0)
 
int encryptionPossible (const QStringList &recipients)
 
EncryptPref encryptionPreference (const QString &address)
 
bool encryptToSelf (void) const
 
QByteArray getAsciiPublicKey (const KeyID &keyID)
 
Kpgp::Result getEncryptionKeys (KeyIDList &encryptionKeyIds, const QStringList &recipients, const KeyID &keyId)
 
bool havePGP (void) const
 
virtual void init ()
 
bool isTrusted (const KeyID &keyID)
 
Validity keyTrust (const KeyID &keyID)
 
Validity keyTrust (const QString &userID)
 
const QString lastErrorMsg (void) const
 
Key * publicKey (const KeyID &keyID)
 
Key * publicKey (const QString &userID)
 
const KeyList publicKeys ()
 
virtual void readConfig ()
 
void readPublicKeys (bool reread=false)
 
void readSecretKeys (bool reread=false)
 
Key * rereadKey (const KeyID &keyID, const bool readTrust=true)
 
Key * secretKey (const KeyID &keyID)
 
const KeyList secretKeys ()
 
KeyID selectPublicKey (const QString &title, const QString &text=QString(), const KeyID &oldKeyId=KeyID(), const QString &address=QString(), const unsigned int allowedKeys=AllKeys)
 
KeyIDList selectPublicKeys (const QString &title, const QString &text=QString(), const KeyIDList &oldKeyIds=KeyIDList(), const QString &address=QString(), const unsigned int allowedKeys=AllKeys)
 
KeyID selectSecretKey (const QString &title, const QString &text=QString(), const KeyID &keyId=KeyID())
 
void setEncryptionPreference (const QString &address, const EncryptPref pref)
 
void setEncryptToSelf (bool flag)
 
void setShowCipherText (const bool flag)
 
void setShowKeyApprovalDlg (const bool flag)
 
void setStorePassPhrase (bool)
 
void setUser (const KeyID &keyID)
 
bool showCipherText (void) const
 
bool showKeyApprovalDlg (void) const
 
bool signKey (const KeyID &keyID)
 
bool storePassPhrase (void) const
 
bool usePGP (void) const
 
const KeyID user () const
 
bool verify (Block &block)
 
virtual void writeConfig (bool sync)
 

Static Public Member Functions

static KConfig * getConfig ()
 
static Kpgp::Module * getKpgp ()
 
static bool prepareMessageForDecryption (const QByteArray &msg, QList< Block > &pgpBlocks, QList< QByteArray > &nonPgpBlocks)
 

Public Attributes

enum Kpgp::Module::PGPType pgpType
 

Protected Member Functions

int doEncSign (Block &block, const KeyIDList &recipientKeyIds, bool sign)
 

Detailed Description

Definition at line 75 of file kpgp.h.

Member Enumeration Documentation

enum Kpgp::Module::PGPType
Enumerator
tAuto 
tGPG 
tPGP2 
tPGP5 
tPGP6 
tOff 

Definition at line 238 of file kpgp.h.

Constructor & Destructor Documentation

Kpgp::Module::~Module ( )
virtual

Definition at line 81 of file kpgp.cpp.

Member Function Documentation

bool Kpgp::Module::changePassPhrase ( )

Request the change of the passphrase of the actual secret key.

TBI

Definition at line 935 of file kpgp.cpp.

void Kpgp::Module::clear ( const bool  erasePassPhrase = false)

clears everything from memory

Definition at line 943 of file kpgp.cpp.

Kpgp::Result Kpgp::Module::clearsign ( Block &  block,
const KeyID &  keyId,
const QByteArray &  charset = 0 
)

clearsigns the given OpenPGP block with the key corresponding to the given key id.

The charset is needed to display the text correctly. Returns Failure if there was an unresolvable error Canceled if signing was canceled Ok if everything is o.k.

Definition at line 327 of file kpgp.cpp.

bool Kpgp::Module::decrypt ( Block &  block)

decrypts the given OpenPGP block if the passphrase is good.

returns false otherwise

Definition at line 283 of file kpgp.cpp.

int Kpgp::Module::doEncSign ( Block &  block,
const KeyIDList &  recipientKeyIds,
bool  sign 
)
protected

Definition at line 501 of file kpgp.cpp.

Kpgp::Result Kpgp::Module::encrypt ( Block &  block,
const QStringList &  receivers,
const KeyID &  keyId,
bool  sign,
const QByteArray &  charset = 0 
)

encrypts the given OpenPGP block for a list of persons.

if sign is true then the block is clearsigned with the key corresponding to the given key id. The charset is needed to display the text correctly. Returns Failure if there was an unresolvable error Canceled if encryption was canceled Ok if everything is o.k.

Definition at line 334 of file kpgp.cpp.

int Kpgp::Module::encryptionPossible ( const QStringList &  recipients)

checks if encrypting to the given list of persons is possible and desired, i.e.

if we have a (trusted) key for every recipient and if encryption to all keys is allowed. Returns 0 if encryption is not possible or not desired, 1 if encryption is possible and desired, 2 if encryption is possible, but the user wants to be asked and -1 if there is a conflict which can't be automatically resolved.

Definition at line 682 of file kpgp.cpp.

EncryptPref Kpgp::Module::encryptionPreference ( const QString &  address)

Reads the encryption preference for the given address from the config file.

Definition at line 1855 of file kpgp.cpp.

bool Kpgp::Module::encryptToSelf ( void  ) const

Definition at line 173 of file kpgp.cpp.

QByteArray Kpgp::Module::getAsciiPublicKey ( const KeyID &  keyID)

try to get an ascii armored key block for the given public key

Definition at line 893 of file kpgp.cpp.

KConfig * Kpgp::Module::getConfig ( )
static

get the kpgp config object

Definition at line 1078 of file kpgp.cpp.

Kpgp::Result Kpgp::Module::getEncryptionKeys ( KeyIDList &  encryptionKeyIds,
const QStringList &  recipients,
const KeyID &  keyId 
)

Determines the keys which should be used for encrypting the message to the given list of recipients.

Returns: Failure if there was an unresolvable error Canceled if encryption was canceled Ok if everything is o.k.

Definition at line 532 of file kpgp.cpp.

Module * Kpgp::Module::getKpgp ( )
static

return the actual pgp object

Definition at line 1067 of file kpgp.cpp.

bool Kpgp::Module::havePGP ( void  ) const

Definition at line 956 of file kpgp.cpp.

void Kpgp::Module::init ( )
virtual

Definition at line 95 of file kpgp.cpp.

bool Kpgp::Module::isTrusted ( const KeyID &  keyID)

Returns TRUE if the given key is at least trusted marginally.

Otherwise FALSE is returned.

Definition at line 860 of file kpgp.cpp.

Validity Kpgp::Module::keyTrust ( const KeyID &  keyID)

Returns the trust value for the given key.

This is the maximal trust value of any of the user ids of this key.

Definition at line 827 of file kpgp.cpp.

Validity Kpgp::Module::keyTrust ( const QString &  userID)

Returns the trust value of a key with the given user id.

If more than one key have this user id then the first key with this user id will be chosen.

Definition at line 842 of file kpgp.cpp.

const QString Kpgp::Module::lastErrorMsg ( void  ) const

returns the last error that occurred

Definition at line 950 of file kpgp.cpp.

bool Kpgp::Module::prepareMessageForDecryption ( const QByteArray &  msg,
QList< Block > &  pgpBlocks,
QList< QByteArray > &  nonPgpBlocks 
)
static

Parses the given message and splits it into OpenPGP blocks and Non-OpenPGP blocks.

Returns TRUE if the message contains at least one OpenPGP block and FALSE otherwise. The format is then:

1st Non-OpenPGP block
1st OpenPGP block
2nd Non-OpenPGP block
...
n-th OpenPGP block
(n+1)-th Non-OpenPGP block

Definition at line 1085 of file kpgp.cpp.

Key * Kpgp::Module::publicKey ( const KeyID &  keyID)

Returns the public key with the given key ID or null if no matching key is found.

Definition at line 786 of file kpgp.cpp.

Key * Kpgp::Module::publicKey ( const QString &  userID)

Returns the first public key with the given user ID or null if no matching key is found.

Definition at line 800 of file kpgp.cpp.

const KeyList Kpgp::Module::publicKeys ( )

get the list of cached public keys.

Definition at line 756 of file kpgp.cpp.

void Kpgp::Module::readConfig ( )
virtual

the following virtual function form the interface to the application using Kpgp

pgpType = (Module::PGPType) config->readEntry("pgpType", tAuto);

Definition at line 118 of file kpgp.cpp.

void Kpgp::Module::readPublicKeys ( bool  reread = false)

Reads the list of public keys if necessary or if reread is true.

Definition at line 1562 of file kpgp.cpp.

void Kpgp::Module::readSecretKeys ( bool  reread = false)

Reads the list of secret keys if necessary or if reread is true.

Definition at line 1605 of file kpgp.cpp.

Key * Kpgp::Module::rereadKey ( const KeyID &  keyID,
const bool  readTrust = true 
)

Rereads the key data for the given key and returns the reread data.

If readTrust is true then the trust of this key will be determined.

Definition at line 866 of file kpgp.cpp.

Key * Kpgp::Module::secretKey ( const KeyID &  keyID)

Returns the secret key with the given key ID or null if no matching key is found.

Definition at line 813 of file kpgp.cpp.

const KeyList Kpgp::Module::secretKeys ( )

get the list of cached secret keys.

Definition at line 771 of file kpgp.cpp.

KeyID Kpgp::Module::selectPublicKey ( const QString &  title,
const QString &  text = QString(),
const KeyID &  oldKeyId = KeyID(),
const QString &  address = QString(),
const unsigned int  allowedKeys = AllKeys 
)

Shows a key selection dialog with all public keys and the given title and the (optional) text.

If oldKeyId is given, then the corresponding key is selected. If address is given, then the chosen key will be stored (if the user wants it to be stored). mode specifies which keys can be selected.

Definition at line 993 of file kpgp.cpp.

KeyIDList Kpgp::Module::selectPublicKeys ( const QString &  title,
const QString &  text = QString(),
const KeyIDList &  oldKeyIds = KeyIDList(),
const QString &  address = QString(),
const unsigned int  allowedKeys = AllKeys 
)

Shows a key selection dialog with all public keys and the given title and the (optional) text.

If oldKeyId is given, then the corresponding key is selected. If address is given, then the chosen key will be stored (if the user wants it to be stored). mode specifies which keys can be selected.

Definition at line 1029 of file kpgp.cpp.

KeyID Kpgp::Module::selectSecretKey ( const QString &  title,
const QString &  text = QString(),
const KeyID &  keyId = KeyID() 
)

Shows a key selection dialog with all secret keys and the given title and the (optional) text.

If keyId is given, then the corresponding key is selected.

Definition at line 974 of file kpgp.cpp.

void Kpgp::Module::setEncryptionPreference ( const QString &  address,
const EncryptPref  pref 
)

Writes the given encryption preference for the given address to the config file.

Definition at line 1867 of file kpgp.cpp.

void Kpgp::Module::setEncryptToSelf ( bool  flag)

always encrypt message to oneself?

Definition at line 167 of file kpgp.cpp.

void Kpgp::Module::setShowCipherText ( const bool  flag)

Definition at line 962 of file kpgp.cpp.

void Kpgp::Module::setShowKeyApprovalDlg ( const bool  flag)
inline

Definition at line 450 of file kpgp.h.

void Kpgp::Module::setStorePassPhrase ( bool  flag)

store passphrase in pgp object Problem: passphrase stays in memory.

Advantage: you can call en-/decrypt without always passing the passphrase

Definition at line 180 of file kpgp.cpp.

void Kpgp::Module::setUser ( const KeyID &  keyID)

set a user identity to use (if you have more than one...) by default, pgp uses the identity which was generated last.

Definition at line 151 of file kpgp.cpp.

bool Kpgp::Module::showCipherText ( void  ) const

Definition at line 968 of file kpgp.cpp.

bool Kpgp::Module::showKeyApprovalDlg ( void  ) const
inline

Definition at line 456 of file kpgp.h.

bool Kpgp::Module::signKey ( const KeyID &  keyID)

sign a key in the keyring with users signature.

Definition at line 740 of file kpgp.cpp.

bool Kpgp::Module::storePassPhrase ( void  ) const

Definition at line 186 of file kpgp.cpp.

bool Kpgp::Module::usePGP ( void  ) const
inline

Should PGP/GnuPG be used?

Definition at line 244 of file kpgp.h.

const KeyID Kpgp::Module::user ( void  ) const

Returns the actual key ID of the currently set key.

Definition at line 160 of file kpgp.cpp.

bool Kpgp::Module::verify ( Block &  block)

Tries to verify the given OpenPGP block.

Definition at line 262 of file kpgp.cpp.

void Kpgp::Module::writeConfig ( bool  sync)
virtual

Why is the pgp object deleted? This is only necessary if the

PGP type was changed in the config dialog.

Definition at line 132 of file kpgp.cpp.

Member Data Documentation

enum Kpgp::Module::PGPType Kpgp::Module::pgpType

The documentation for this class was generated from the following files:
  • kpgp.h
  • kpgp.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkpgp

Skip menu "libkpgp"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal