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

libkpgp

Kpgp::Module

Kpgp::Module Class Reference

#include <kpgp.h>

List of all members.


Detailed Description

Definition at line 75 of file kpgp.h.


Public Types

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

Public Member Functions

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 QString &userID)
Validity keyTrust (const KeyID &keyID)
const QString lastErrorMsg (void) const
 Module ()
Key * publicKey (const QString &userID)
Key * publicKey (const KeyID &keyID)
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)
virtual ~Module ()

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)

Member Enumeration Documentation

enum Kpgp::Module::PGPType

Enumerator:
tAuto 
tGPG 
tPGP2 
tPGP5 
tPGP6 
tOff 

Definition at line 234 of file kpgp.h.


Constructor & Destructor Documentation

Kpgp::Module::Module (  ) 

Definition at line 64 of file kpgp.cpp.

Kpgp::Module::~Module (  )  [virtual]

Definition at line 82 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 885 of file kpgp.cpp.

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

clears everything from memory

Definition at line 893 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 319 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 279 of file kpgp.cpp.

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

Definition at line 469 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 326 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 636 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 1781 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 843 of file kpgp.cpp.

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

get the kpgp config object

Definition at line 1028 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 500 of file kpgp.cpp.

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

return the actual pgp object

Definition at line 1017 of file kpgp.cpp.

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

Definition at line 906 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 811 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 793 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 778 of file kpgp.cpp.

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

returns the last error that occurred

Definition at line 900 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 1035 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 753 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 740 of file kpgp.cpp.

const KeyList Kpgp::Module::publicKeys (  ) 

get the list of cached public keys.

Definition at line 710 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 1512 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 1555 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 817 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 765 of file kpgp.cpp.

const KeyList Kpgp::Module::secretKeys (  ) 

get the list of cached secret keys.

Definition at line 725 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 943 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 979 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 924 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 1793 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 912 of file kpgp.cpp.

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

Definition at line 447 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 918 of file kpgp.cpp.

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

Definition at line 453 of file kpgp.h.

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

sign a key in the keyring with users signature.

Definition at line 694 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 240 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 258 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

libkpgp

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal