libkpgp

Kpgp::Module Class Reference

List of all members.

Detailed Description

Definition at line 81 of file kpgp.h.


Public Types

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

Public Member Functions

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

Static Public Member Functions

static Kpgp::ModulegetKpgp ()
static KConfig * getConfig ()
static bool prepareMessageForDecryption (const QCString &msg, QPtrList< Block > &pgpBlocks, QStrList &nonPgpBlocks)

Public Attributes

enum Kpgp::Module::PGPType pgpType

Protected Member Functions

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

Friends

class Block

Member Function Documentation

void Kpgp::Module::readConfig (  )  [virtual]

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

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

Definition at line 108 of file kpgp.cpp.

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

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

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

Tries to verify the given OpenPGP block.

Definition at line 247 of file kpgp.cpp.

Kpgp::Result Kpgp::Module::clearsign ( Block block,
const KeyID keyId,
const QCString &  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 308 of file kpgp.cpp.

Kpgp::Result Kpgp::Module::encrypt ( Block block,
const QStringList &  receivers,
const KeyID keyId,
bool  sign,
const QCString &  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 315 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 489 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 625 of file kpgp.cpp.

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

sign a key in the keyring with users signature.

Definition at line 683 of file kpgp.cpp.

const KeyList Kpgp::Module::publicKeys (  ) 

get the list of cached public keys.

Definition at line 699 of file kpgp.cpp.

const KeyList Kpgp::Module::secretKeys (  ) 

get the list of cached secret keys.

Definition at line 714 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 1513 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 1556 of file kpgp.cpp.

QCString Kpgp::Module::getAsciiPublicKey ( const KeyID keyID  ) 

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

Definition at line 832 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 729 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 742 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 754 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 767 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 782 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 800 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 806 of file kpgp.cpp.

bool Kpgp::Module::changePassPhrase (  ) 

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

TBI

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

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

Returns the actual key ID of the currently set key.

Definition at line 149 of file kpgp.cpp.

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

always encrypt message to oneself?

Definition at line 156 of file kpgp.cpp.

void Kpgp::Module::setStorePassPhrase ( bool   ) 

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

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

Definition at line 169 of file kpgp.cpp.

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

clears everything from memory

Definition at line 882 of file kpgp.cpp.

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

returns the last error that occurred

Definition at line 889 of file kpgp.cpp.

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

Should PGP/GnuPG be used?

Definition at line 246 of file kpgp.h.

KeyID Kpgp::Module::selectSecretKey ( const QString &  title,
const QString &  text = QString::null,
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 913 of file kpgp.cpp.

KeyID Kpgp::Module::selectPublicKey ( const QString &  title,
const QString &  text = QString::null,
const KeyID oldKeyId = KeyID(),
const QString &  address = QString::null,
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 932 of file kpgp.cpp.

KeyIDList Kpgp::Module::selectPublicKeys ( const QString &  title,
const QString &  text = QString::null,
const KeyIDList oldKeyIds = KeyIDList(),
const QString &  address = QString::null,
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 968 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 1782 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 1794 of file kpgp.cpp.

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

return the actual pgp object

Definition at line 1006 of file kpgp.cpp.

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

get the kpgp config object

Definition at line 1017 of file kpgp.cpp.

bool Kpgp::Module::prepareMessageForDecryption ( const QCString &  msg,
QPtrList< Block > &  pgpBlocks,
QStrList &  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 1024 of file kpgp.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys