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

libkpgp

  • sources
  • kde-4.14
  • kdepim
  • libkpgp
kpgpkey.h
Go to the documentation of this file.
1 /*
2  kpgpkey.h
3 
4  Copyright (C) 2001,2002 the KPGP authors
5  See file AUTHORS.kpgp for details
6 
7  This file is part of KPGP, the KDE PGP/GnuPG support library.
8 
9  KPGP is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software Foundation,
16  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #ifndef KPGPKEY_H
20 #define KPGPKEY_H
21 
22 #include <QtCore/QString>
23 #include <QtCore/QStringList>
24 
25 #include <time.h>
26 
27 namespace Kpgp {
28 
32 typedef enum
33 { // this is copied from gpgme.h which is a part of GPGME
34  KPGP_VALIDITY_UNKNOWN = 0, // the trust hasn't been determined
35  KPGP_VALIDITY_UNDEFINED = 1, // trust is undefined
36  KPGP_VALIDITY_NEVER = 2,
37  KPGP_VALIDITY_MARGINAL = 3,
38  KPGP_VALIDITY_FULL = 4,
39  KPGP_VALIDITY_ULTIMATE = 5
40 } Validity;
41 
44 typedef enum
45 {
46  NeverEncrypt = -1,
47  UnknownEncryptPref = 0,
48  AlwaysEncrypt = 1,
49  AlwaysEncryptIfPossible = 2,
50  AlwaysAskForEncryption = 3,
51  AskWheneverPossible = 4
52 } EncryptPref;
53 
54 
55 typedef QByteArray KeyID;
56 
57 class KeyIDList : public QList<KeyID>
58 {
59  public:
60  KeyIDList() { }
61  KeyIDList( const KeyIDList& l ) : QList<KeyID>(l) { }
62  KeyIDList( const QList<KeyID>& l ) : QList<KeyID>(l) { }
63  explicit KeyIDList( const KeyID& i ) { append(i); }
64 
65  QStringList toStringList() const;
66 
67  static KeyIDList fromStringList( const QStringList& );
68 };
69 
72 class UserID
73 {
74  public:
83  explicit UserID(const QString& str,
84  const Validity validity = KPGP_VALIDITY_UNKNOWN,
85  const bool revoked = false,
86  const bool invalid = false);
87  ~UserID() {}
88 
90  QString text() const;
91 
93  bool revoked() const;
94 
96  bool invalid() const;
97 
99  Validity validity() const;
100 
104  void setText(const QString& str);
105 
111  void setRevoked(const bool revoked);
112 
119  void setInvalid(const bool invalid);
120 
125  void setValidity(const Validity validity);
126 
127  protected:
129  bool mRevoked : 1;
131  bool mInvalid : 1;
133  Validity mValidity;
135  QString mText;
136 };
137 
138 typedef QList<UserID*> UserIDList;
139 
140 inline QString UserID::text() const
141 {
142  return mText;
143 }
144 
145 inline bool UserID::revoked() const
146 {
147  return mRevoked;
148 }
149 
150 inline bool UserID::invalid() const
151 {
152  return mInvalid;
153 }
154 
155 inline Validity UserID::validity() const
156 {
157  return mValidity;
158 }
159 
160 inline void UserID::setText(const QString& str)
161 {
162  mText = str;
163 }
164 
165 inline void UserID::setRevoked(const bool revoked)
166 {
167  mRevoked = revoked;
168 }
169 
170 inline void UserID::setInvalid(const bool invalid)
171 {
172  mInvalid = invalid;
173 }
174 
175 inline void UserID::setValidity(const Validity validity)
176 {
177  mValidity = validity;
178 }
179 
180 
183 class Subkey
184 {
185  public:
187  explicit Subkey(const KeyID& keyID, const bool secret = false);
188  ~Subkey() {}
189 
191  bool secret() const;
192 
194  bool revoked() const;
195 
197  bool expired() const;
198 
200  bool disabled() const;
201 
203  bool invalid() const;
204 
206  bool canEncrypt() const;
207 
209  bool canSign() const;
210 
212  bool canCertify() const;
213 
215  unsigned int keyAlgorithm() const;
216 
218  unsigned int keyLength() const;
219 
222  KeyID longKeyID() const;
223 
225  KeyID keyID() const;
226 
228  QByteArray fingerprint() const;
229 
231  time_t creationDate() const;
232 
234  time_t expirationDate() const;
235 
240  void setSecret(const bool secret);
241 
246  void setRevoked(const bool revoked);
247 
252  void setExpired(const bool expired);
253 
258  void setDisabled(const bool disabled);
259 
264  void setInvalid(const bool invalid);
265 
270  void setCanEncrypt(const bool canEncrypt);
271 
276  void setCanSign(const bool canSign);
277 
282  void setCanCertify(const bool canCertify);
283 
290  void setKeyAlgorithm(const unsigned int keyAlgo);
291 
297  void setKeyLength(const unsigned int keyLen);
298 
304  void setKeyID(const KeyID& keyID);
305 
311  void setFingerprint(const QByteArray& fingerprint);
312 
319  void setCreationDate(const time_t creationDate);
320 
328  void setExpirationDate(const time_t expirationDate);
329 
330  protected:
332  bool mSecret : 1;
334  bool mRevoked : 1;
336  bool mExpired : 1;
338  bool mDisabled : 1;
340  bool mInvalid : 1;
342  bool mCanEncrypt : 1;
344  bool mCanSign : 1;
346  bool mCanCertify : 1;
347 
348  unsigned int mKeyAlgo;
349  unsigned int mKeyLen;
350  KeyID mKeyID;
351  QByteArray mFingerprint;
352  time_t mTimestamp;
353  time_t mExpiration;
354 };
355 
356 inline bool Subkey::secret() const
357 {
358  return mSecret;
359 }
360 
361 inline bool Subkey::revoked() const
362 {
363  return mRevoked;
364 }
365 
366 inline bool Subkey::expired() const
367 {
368  return mExpired;
369 }
370 
371 inline bool Subkey::disabled() const
372 {
373  return mDisabled;
374 }
375 
376 inline bool Subkey::invalid() const
377 {
378  return mInvalid;
379 }
380 
381 inline bool Subkey::canEncrypt() const
382 {
383  return mCanEncrypt;
384 }
385 
386 inline bool Subkey::canSign() const
387 {
388  return mCanSign;
389 }
390 
391 inline bool Subkey::canCertify() const
392 {
393  return mCanCertify;
394 }
395 
396 inline unsigned int Subkey::keyAlgorithm() const
397 {
398  return mKeyAlgo;
399 }
400 
401 inline unsigned int Subkey::keyLength() const
402 {
403  return mKeyLen;
404 }
405 
406 inline KeyID Subkey::longKeyID() const
407 {
408  return mKeyID;
409 }
410 
411 inline KeyID Subkey::keyID() const
412 {
413  return mKeyID.right(8);
414 }
415 
416 inline QByteArray Subkey::fingerprint() const
417 {
418  return mFingerprint;
419 }
420 
421 inline time_t Subkey::creationDate() const
422 {
423  return mTimestamp;
424 }
425 
426 inline time_t Subkey::expirationDate() const
427 {
428  return mExpiration;
429 }
430 
431 inline void Subkey::setSecret(const bool secret)
432 {
433  mSecret = secret;
434 }
435 
436 inline void Subkey::setRevoked(const bool revoked)
437 {
438  mRevoked = revoked;
439 }
440 
441 inline void Subkey::setExpired(const bool expired)
442 {
443  mExpired = expired;
444 }
445 
446 inline void Subkey::setDisabled(const bool disabled)
447 {
448  mDisabled = disabled;
449 }
450 
451 inline void Subkey::setInvalid(const bool invalid)
452 {
453  mInvalid = invalid;
454 }
455 
456 inline void Subkey::setCanEncrypt(const bool canEncrypt)
457 {
458  mCanEncrypt = canEncrypt;
459 }
460 
461 inline void Subkey::setCanSign(const bool canSign)
462 {
463  mCanSign = canSign;
464 }
465 
466 inline void Subkey::setCanCertify(const bool canCertify)
467 {
468  mCanCertify = canCertify;
469 }
470 
471 inline void Subkey::setKeyAlgorithm(const unsigned int keyAlgo)
472 {
473  mKeyAlgo = keyAlgo;
474 }
475 
476 inline void Subkey::setKeyLength(const unsigned int keyLen)
477 {
478  mKeyLen = keyLen;
479 }
480 
481 inline void Subkey::setKeyID(const KeyID& keyID)
482 {
483  mKeyID = keyID;
484 }
485 
486 inline void Subkey::setFingerprint(const QByteArray& fingerprint)
487 {
488  mFingerprint = fingerprint;
489 }
490 
491 inline void Subkey::setCreationDate(const time_t creationDate)
492 {
493  mTimestamp = creationDate;
494 }
495 
496 inline void Subkey::setExpirationDate(const time_t expirationDate)
497 {
498  mExpiration = expirationDate;
499 }
500 
501 typedef QList<Subkey*> SubkeyList;
502 
503 
506 class Key
507 {
508  public:
515  explicit Key( const KeyID& keyid = KeyID(),
516  const QString& uid = QString(),
517  const bool secret = false);
518  ~Key();
519 
521  void clear();
522 
524  bool secret() const;
525 
527  bool revoked() const;
528 
530  bool expired() const;
531 
533  bool disabled() const;
534 
536  bool invalid() const;
537 
539  bool canEncrypt() const;
540 
542  bool canSign() const;
543 
545  bool canCertify() const;
546 
551  void setSecret(const bool secret);
552 
557  void setRevoked(const bool revoked);
558 
560  void setExpired(const bool expired);
561 
563  void setDisabled(const bool disabled);
564 
566  void setInvalid(const bool invalid);
567 
570  void setCanEncrypt(const bool canEncrypt);
571 
574  void setCanSign(const bool canSign);
575 
578  void setCanCertify(const bool canCertify);
579 
580 
582  EncryptPref encryptionPreference();
583 
585  void setEncryptionPreference( const EncryptPref encrPref );
586 
587 
590  QString primaryUserID() const;
591 
594  KeyID primaryKeyID() const;
595 
598  QByteArray primaryFingerprint() const;
599 
601  bool isNull() const;
602 
605  time_t creationDate() const;
606 
610  Validity keyTrust() const;
611 
614  Validity keyTrust( const QString& uid ) const;
615 
620  void cloneKeyTrust( const Key* key );
621 
625  bool isValid() const;
626 
630  bool isValidEncryptionKey() const;
631 
634  bool isValidSigningKey() const;
635 
637  const UserIDList userIDs() const;
638 
640  const SubkeyList subkeys() const;
641 
644  void addUserID(const QString& uid,
645  const Validity validity = KPGP_VALIDITY_UNKNOWN,
646  const bool revoked = false,
647  const bool invalid = false);
648 
650  void addUserID(const UserID *userID);
651 
655  bool matchesUserID(const QString& str, bool cs = true);
656 
659  void addSubkey(const KeyID& keyID, const bool secret = false);
660 
662  void addSubkey(const Subkey *subkey);
663 
665  Subkey *getSubkey(const KeyID& keyID);
666 
668  void setFingerprint(const KeyID& keyID, const QByteArray& fpr);
669 
670  protected:
671  bool mSecret : 1;
672  /* global flags */
673  bool mRevoked : 1;
674  bool mExpired : 1;
675  bool mDisabled : 1;
676  bool mInvalid : 1;
677  bool mCanEncrypt : 1;
678  bool mCanSign : 1;
679  bool mCanCertify : 1;
680 
681  EncryptPref mEncryptPref;
682 
683  SubkeyList mSubkeys;
684  UserIDList mUserIDs;
685 };
686 
687 inline bool Key::secret() const
688 {
689  return mSecret;
690 }
691 
692 inline bool Key::revoked() const
693 {
694  return mRevoked;
695 }
696 
697 inline bool Key::expired() const
698 {
699  return mExpired;
700 }
701 
702 inline bool Key::disabled() const
703 {
704  return mDisabled;
705 }
706 
707 inline bool Key::invalid() const
708 {
709  return mInvalid;
710 }
711 
712 inline bool Key::canEncrypt() const
713 {
714  return mCanEncrypt;
715 }
716 
717 inline bool Key::canSign() const
718 {
719  return mCanSign;
720 }
721 
722 inline bool Key::canCertify() const
723 {
724  return mCanCertify;
725 }
726 
727 inline void Key::setSecret(const bool secret)
728 {
729  mSecret = secret;
730 }
731 
732 inline void Key::setRevoked(const bool revoked)
733 {
734  mRevoked = revoked;
735 }
736 
737 inline void Key::setExpired(const bool expired)
738 {
739  mExpired = expired;
740 }
741 
742 inline void Key::setDisabled(const bool disabled)
743 {
744  mDisabled = disabled;
745 }
746 
747 inline void Key::setInvalid(const bool invalid)
748 {
749  mInvalid = invalid;
750 }
751 
752 inline void Key::setCanEncrypt(const bool canEncrypt)
753 {
754  mCanEncrypt = canEncrypt;
755 }
756 
757 inline void Key::setCanSign(const bool canSign)
758 {
759  mCanSign = canSign;
760 }
761 
762 inline void Key::setCanCertify(const bool canCertify)
763 {
764  mCanCertify = canCertify;
765 }
766 
767 inline EncryptPref Key::encryptionPreference()
768 {
769  return mEncryptPref;
770 }
771 
772 inline void Key::setEncryptionPreference( const EncryptPref encrPref )
773 {
774  mEncryptPref = encrPref;
775 }
776 
777 inline QString Key::primaryUserID() const
778 {
779  UserID *uid = mUserIDs.isEmpty() ? 0 : mUserIDs.first();
780 
781  if (uid)
782  return uid->text();
783  else
784  return QString();
785 }
786 
787 inline KeyID Key::primaryKeyID() const
788 {
789  Subkey *key = mSubkeys.isEmpty() ? 0 : mSubkeys.first();
790 
791  if (key)
792  return key->keyID();
793  else
794  return KeyID();
795 }
796 
797 inline QByteArray Key::primaryFingerprint() const
798 {
799  Subkey *key = mSubkeys.isEmpty() ? 0 : mSubkeys.first();
800 
801  if (key)
802  return key->fingerprint();
803  else
804  return QByteArray();
805 }
806 
807 inline const UserIDList Key::userIDs() const
808 {
809  return mUserIDs;
810 }
811 
812 inline const SubkeyList Key::subkeys() const
813 {
814  return mSubkeys;
815 }
816 
817 inline bool Key::isNull() const
818 {
819  return (mUserIDs.isEmpty() || mSubkeys.isEmpty());
820 }
821 
822 inline time_t Key::creationDate() const
823 {
824  if( !mSubkeys.isEmpty() )
825  return mSubkeys.first()->creationDate();
826  else
827  return -1;
828 }
829 
830 inline void Key::addUserID(const UserID *userID)
831 {
832  if (userID)
833  mUserIDs.append(const_cast<UserID*>(userID));
834 }
835 
836 inline void Key::addSubkey(const Subkey *subkey)
837 {
838  if (subkey)
839  mSubkeys.append(const_cast<Subkey*>(subkey));
840 }
841 
842 
843 typedef QList<Key*> KeyList;
844 
845 inline bool KeyCompare( Key* left, Key* right )
846 {
847  const int result = QString::compare( left->primaryUserID().toLower(), right->primaryUserID().toLower() );
848  return result == -1;
849 }
850 
851 } // namespace Kpgp
852 
853 #endif
Kpgp::Key::isValidEncryptionKey
bool isValidEncryptionKey() const
Returns true if the key is a valid encryption key.
Definition: kpgpkey.cpp:187
Kpgp::Subkey::setRevoked
void setRevoked(const bool revoked)
Sets the flag if the subkey has been revoked to revoked .
Definition: kpgpkey.h:436
Kpgp::Validity
Validity
These are the possible validity values for a PGP user id and for the owner trust. ...
Definition: kpgpkey.h:32
Kpgp::KeyList
QList< Key * > KeyList
Definition: kpgpkey.h:843
Kpgp::Subkey::mDisabled
bool mDisabled
Is this subkey disabled?
Definition: kpgpkey.h:338
Kpgp::Key::Key
Key(const KeyID &keyid=KeyID(), const QString &uid=QString(), const bool secret=false)
Constructs a new PGP key with keyid as key ID of the primary key and uid as primary user ID...
Definition: kpgpkey.cpp:87
Kpgp::UserID::~UserID
~UserID()
Definition: kpgpkey.h:87
Kpgp::KeyIDList::fromStringList
static KeyIDList fromStringList(const QStringList &)
Converts from a QStringList to a KeyIDList.
Definition: kpgpkey.cpp:41
Kpgp::Key::mSubkeys
SubkeyList mSubkeys
Definition: kpgpkey.h:683
Kpgp::Key::setCanCertify
void setCanCertify(const bool canCertify)
Sets the flag if the key can be used to certify keys to canCertify .
Definition: kpgpkey.h:762
Kpgp::Subkey::canEncrypt
bool canEncrypt() const
Returns true if the subkey can be used to encrypt data.
Definition: kpgpkey.h:381
Kpgp::Key::mCanEncrypt
bool mCanEncrypt
Definition: kpgpkey.h:677
Kpgp::KeyIDList::KeyIDList
KeyIDList(const QList< KeyID > &l)
Definition: kpgpkey.h:62
Kpgp::Key::setFingerprint
void setFingerprint(const KeyID &keyID, const QByteArray &fpr)
Sets the fingerprint of the given subkey to fpr .
Definition: kpgpkey.cpp:252
Kpgp::Subkey::setDisabled
void setDisabled(const bool disabled)
Sets the flag if the subkey has been disabled to disabled .
Definition: kpgpkey.h:446
Kpgp::Key::userIDs
const UserIDList userIDs() const
Returns the list of userIDs.
Definition: kpgpkey.h:807
Kpgp::UserID::mValidity
Validity mValidity
Validity (assuming invalid flag is false).
Definition: kpgpkey.h:133
Kpgp::Subkey::setExpired
void setExpired(const bool expired)
Sets the flag if the subkey has expired to expired .
Definition: kpgpkey.h:441
QByteArray
Kpgp::Key::mCanCertify
bool mCanCertify
Definition: kpgpkey.h:679
Kpgp::Subkey::canCertify
bool canCertify() const
Returns true if the subkey can be used to certify keys.
Definition: kpgpkey.h:391
Kpgp::Subkey::mTimestamp
time_t mTimestamp
-1 for invalid, 0 for not available
Definition: kpgpkey.h:352
Kpgp::UserID::setText
void setText(const QString &str)
Sets the text of the user id to str.
Definition: kpgpkey.h:160
Kpgp::KPGP_VALIDITY_ULTIMATE
Definition: kpgpkey.h:39
Kpgp::Key::setCanEncrypt
void setCanEncrypt(const bool canEncrypt)
Sets the flag if the key can be used to encrypt data to canEncrypt .
Definition: kpgpkey.h:752
Kpgp::Key::setEncryptionPreference
void setEncryptionPreference(const EncryptPref encrPref)
Sets the encryption preference for this key to encrPref .
Definition: kpgpkey.h:772
Kpgp::Subkey::mExpiration
time_t mExpiration
-1 for never, 0 for not available
Definition: kpgpkey.h:353
Kpgp::Key::mUserIDs
UserIDList mUserIDs
Definition: kpgpkey.h:684
Kpgp::KPGP_VALIDITY_FULL
Definition: kpgpkey.h:38
Kpgp::Subkey::setKeyLength
void setKeyLength(const unsigned int keyLen)
Sets the key length of the subkey to keyLen bits.
Definition: kpgpkey.h:476
Kpgp::Key::subkeys
const SubkeyList subkeys() const
Returns the list of subkeys.
Definition: kpgpkey.h:812
Kpgp::Subkey::canSign
bool canSign() const
Returns true if the subkey can be used to sign data.
Definition: kpgpkey.h:386
Kpgp::Subkey::mCanSign
bool mCanSign
Can this subkey sign?
Definition: kpgpkey.h:344
Kpgp::Key::canEncrypt
bool canEncrypt() const
Returns true if the key can be used to encrypt data.
Definition: kpgpkey.h:712
Kpgp::Subkey::setInvalid
void setInvalid(const bool invalid)
Sets the flag if the subkey is invalid to invalid .
Definition: kpgpkey.h:451
Kpgp::Key::creationDate
time_t creationDate() const
Returns the creation date of the primary subkey.
Definition: kpgpkey.h:822
Kpgp::Key::isValid
bool isValid() const
Returns true if the key is valid, i.e.
Definition: kpgpkey.cpp:180
Kpgp::Subkey::setCanSign
void setCanSign(const bool canSign)
Sets the flag if the subkey can be used to sign data to canSign .
Definition: kpgpkey.h:461
Kpgp::Subkey::setKeyID
void setKeyID(const KeyID &keyID)
Sets the key ID of the subkey to keyID .
Definition: kpgpkey.h:481
Kpgp::Key::setSecret
void setSecret(const bool secret)
Sets the flag if the key is a secret key to secret .
Definition: kpgpkey.h:727
Kpgp::Key::invalid
bool invalid() const
Returns true if the key is invalid.
Definition: kpgpkey.h:707
Kpgp::Subkey::mCanCertify
bool mCanCertify
Can this subkey certify?
Definition: kpgpkey.h:346
Kpgp::Subkey::~Subkey
~Subkey()
Definition: kpgpkey.h:188
Kpgp::Subkey::mCanEncrypt
bool mCanEncrypt
Can this subkey encrypt?
Definition: kpgpkey.h:342
Kpgp::Key::canSign
bool canSign() const
Returns true if the key can be used to sign data.
Definition: kpgpkey.h:717
Kpgp::KeyIDList::KeyIDList
KeyIDList(const KeyID &i)
Definition: kpgpkey.h:63
Kpgp::Key::disabled
bool disabled() const
Returns true if the key has been disabled.
Definition: kpgpkey.h:702
Kpgp::Key::mExpired
bool mExpired
Definition: kpgpkey.h:674
Kpgp::Key::setDisabled
void setDisabled(const bool disabled)
Sets the flag if the key has been disabled to disabled .
Definition: kpgpkey.h:742
Kpgp::UserID::setInvalid
void setInvalid(const bool invalid)
Sets the flag if the user id is invalid to invalid.
Definition: kpgpkey.h:170
Kpgp::Key::revoked
bool revoked() const
Returns true if the key has been revoked.
Definition: kpgpkey.h:692
Kpgp::Key::secret
bool secret() const
Returns true if the key is a secret key.
Definition: kpgpkey.h:687
Kpgp::KeyCompare
bool KeyCompare(Key *left, Key *right)
Definition: kpgpkey.h:845
QList< KeyID >::append
void append(const T &value)
Kpgp::UserID::mInvalid
bool mInvalid
Invalid flag.
Definition: kpgpkey.h:131
Kpgp::Key::encryptionPreference
EncryptPref encryptionPreference()
Returns the encryption preference for this key.
Definition: kpgpkey.h:767
Kpgp::Subkey::revoked
bool revoked() const
Returns true if the subkey has been revoked.
Definition: kpgpkey.h:361
Kpgp::Subkey::mSecret
bool mSecret
Is this subkey secret?
Definition: kpgpkey.h:332
Kpgp::Key::~Key
~Key()
Definition: kpgpkey.cpp:107
Kpgp::Key::setInvalid
void setInvalid(const bool invalid)
Sets the flag if the key is invalid to invalid .
Definition: kpgpkey.h:747
Kpgp::Subkey::longKeyID
KeyID longKeyID() const
Returns the long 64 bit key ID of the subkey if it's available.
Definition: kpgpkey.h:406
Kpgp::Subkey::keyID
KeyID keyID() const
Returns the (short) 32 bit key ID of the subkey.
Definition: kpgpkey.h:411
Kpgp::Subkey::expired
bool expired() const
Returns true if the subkey has expired.
Definition: kpgpkey.h:366
QList::isEmpty
bool isEmpty() const
Kpgp::Subkey
This class is used to store information about a subkey of a PGP key.
Definition: kpgpkey.h:183
Kpgp::Key::addUserID
void addUserID(const QString &uid, const Validity validity=KPGP_VALIDITY_UNKNOWN, const bool revoked=false, const bool invalid=false)
Adds a user ID with the given values to the key if uid isn't an empty string.
Definition: kpgpkey.cpp:200
QByteArray::right
QByteArray right(int len) const
Kpgp::UserID::setRevoked
void setRevoked(const bool revoked)
Sets the flag if the user id has been revoked to revoked.
Definition: kpgpkey.h:165
Kpgp::KeyID
QByteArray KeyID
Definition: kpgpkey.h:55
Kpgp::KeyIDList::KeyIDList
KeyIDList(const KeyIDList &l)
Definition: kpgpkey.h:61
Kpgp::Subkey::invalid
bool invalid() const
Returns true if the subkey is invalid.
Definition: kpgpkey.h:376
Kpgp::AlwaysAskForEncryption
Definition: kpgpkey.h:50
Kpgp::Subkey::mRevoked
bool mRevoked
Is this subkey revoked?
Definition: kpgpkey.h:334
Kpgp::Key::expired
bool expired() const
Returns true if the key has expired.
Definition: kpgpkey.h:697
Kpgp::Subkey::expirationDate
time_t expirationDate() const
Returns the expiration date of the subkey.
Definition: kpgpkey.h:426
Kpgp::KPGP_VALIDITY_UNDEFINED
Definition: kpgpkey.h:35
Kpgp::UserID::invalid
bool invalid() const
Returns true if the user id is invalid.
Definition: kpgpkey.h:150
Kpgp::Subkey::fingerprint
QByteArray fingerprint() const
Returns the fingerprint of the subkey.
Definition: kpgpkey.h:416
Kpgp::Subkey::creationDate
time_t creationDate() const
Returns the creation date of the subkey.
Definition: kpgpkey.h:421
Kpgp::Key::mInvalid
bool mInvalid
Definition: kpgpkey.h:676
Kpgp::Subkey::mExpired
bool mExpired
Is this subkey expired?
Definition: kpgpkey.h:336
Kpgp::Key::mDisabled
bool mDisabled
Definition: kpgpkey.h:675
QList::first
T & first()
QString
QList
Kpgp::KeyIDList
Definition: kpgpkey.h:57
Kpgp::Subkey::setSecret
void setSecret(const bool secret)
Sets the flag if the subkey is a secret subkey to secret .
Definition: kpgpkey.h:431
Kpgp::UserID::UserID
UserID(const QString &str, const Validity validity=KPGP_VALIDITY_UNKNOWN, const bool revoked=false, const bool invalid=false)
Constructs a new user id with the given values.
Definition: kpgpkey.cpp:53
Kpgp::UserID::mRevoked
bool mRevoked
Revoked flag.
Definition: kpgpkey.h:129
Kpgp::Key::primaryUserID
QString primaryUserID() const
Returns the primary user ID or a null string if there are no user IDs.
Definition: kpgpkey.h:777
Kpgp::UserID::setValidity
void setValidity(const Validity validity)
Sets the validity of resp.
Definition: kpgpkey.h:175
Kpgp::UserIDList
QList< UserID * > UserIDList
Definition: kpgpkey.h:138
Kpgp::Subkey::setExpirationDate
void setExpirationDate(const time_t expirationDate)
Sets the expiration date of the subkey to expirationDate seconds since Epoch.
Definition: kpgpkey.h:496
QStringList
Kpgp::Key::keyTrust
Validity keyTrust() const
Returns the trust value of this key.
Definition: kpgpkey.cpp:137
Kpgp::UserID
This class is used to store information about a user id of a PGP key.
Definition: kpgpkey.h:72
QString::toLower
QString toLower() const
Kpgp::KPGP_VALIDITY_MARGINAL
Definition: kpgpkey.h:37
Kpgp::Key::canCertify
bool canCertify() const
Returns true if the key can be used to certify keys.
Definition: kpgpkey.h:722
Kpgp::Subkey::keyAlgorithm
unsigned int keyAlgorithm() const
Returns the key algorithm of the subkey.
Definition: kpgpkey.h:396
Kpgp::Subkey::keyLength
unsigned int keyLength() const
Returns the length of the subkey in bits.
Definition: kpgpkey.h:401
Kpgp::Subkey::disabled
bool disabled() const
Returns true if the subkey has been disabled.
Definition: kpgpkey.h:371
Kpgp::KeyIDList::KeyIDList
KeyIDList()
Definition: kpgpkey.h:60
Kpgp::Key::isValidSigningKey
bool isValidSigningKey() const
Returns true if the key is a valid signing key.
Definition: kpgpkey.cpp:194
Kpgp::UserID::validity
Validity validity() const
Returns the validity of resp.
Definition: kpgpkey.h:155
Kpgp::UserID::text
QString text() const
Returns the text of the user id.
Definition: kpgpkey.h:140
Kpgp::NeverEncrypt
Definition: kpgpkey.h:46
Kpgp::AskWheneverPossible
Definition: kpgpkey.h:51
Kpgp::SubkeyList
QList< Subkey * > SubkeyList
Definition: kpgpkey.h:501
Kpgp::Subkey::setCanCertify
void setCanCertify(const bool canCertify)
Sets the flag if the subkey can be used to certify keys to canCertify .
Definition: kpgpkey.h:466
Kpgp::Subkey::mKeyLen
unsigned int mKeyLen
Definition: kpgpkey.h:349
Kpgp::Key::primaryFingerprint
QByteArray primaryFingerprint() const
Returns the fingerprint of the primary key or a null string if there are no subkeys.
Definition: kpgpkey.h:797
Kpgp::Subkey::mInvalid
bool mInvalid
Is this subkey invalid?
Definition: kpgpkey.h:340
Kpgp::Key::mRevoked
bool mRevoked
Definition: kpgpkey.h:673
Kpgp::Subkey::setFingerprint
void setFingerprint(const QByteArray &fingerprint)
Sets the fingerprint of the subkey to fingerprint .
Definition: kpgpkey.h:486
Kpgp::EncryptPref
EncryptPref
These are the possible preferences for encryption.
Definition: kpgpkey.h:44
Kpgp::Subkey::setKeyAlgorithm
void setKeyAlgorithm(const unsigned int keyAlgo)
Sets the key algorithm of the subkey to keyAlgo .
Definition: kpgpkey.h:471
Kpgp::Key::mSecret
bool mSecret
Definition: kpgpkey.h:671
Kpgp::Subkey::secret
bool secret() const
Returns true if the subkey is a secret subkey.
Definition: kpgpkey.h:356
Kpgp::Key::addSubkey
void addSubkey(const KeyID &keyID, const bool secret=false)
Adds a subkey with the given values to the key if keyID isn't an empty string.
Definition: kpgpkey.cpp:222
Kpgp::Key::setExpired
void setExpired(const bool expired)
Sets the flag if the key has expired to expired .
Definition: kpgpkey.h:737
Kpgp::Subkey::mKeyAlgo
unsigned int mKeyAlgo
Definition: kpgpkey.h:348
Kpgp::Subkey::mKeyID
KeyID mKeyID
Definition: kpgpkey.h:350
Kpgp::Key::setRevoked
void setRevoked(const bool revoked)
Sets the flag if the key has been revoked to revoked .
Definition: kpgpkey.h:732
Kpgp::AlwaysEncrypt
Definition: kpgpkey.h:48
Kpgp::KPGP_VALIDITY_NEVER
Definition: kpgpkey.h:36
Kpgp::UnknownEncryptPref
Definition: kpgpkey.h:47
Kpgp::Key
This class is used to store information about a PGP key.
Definition: kpgpkey.h:506
Kpgp::KPGP_VALIDITY_UNKNOWN
Definition: kpgpkey.h:34
Kpgp::Subkey::mFingerprint
QByteArray mFingerprint
Definition: kpgpkey.h:351
Kpgp::AlwaysEncryptIfPossible
Definition: kpgpkey.h:49
Kpgp::UserID::mText
QString mText
User id (descriptive text).
Definition: kpgpkey.h:135
Kpgp::KeyIDList::toStringList
QStringList toStringList() const
Converts from a KeyIDList to a QStringList.
Definition: kpgpkey.cpp:30
Kpgp::Key::mEncryptPref
EncryptPref mEncryptPref
Definition: kpgpkey.h:681
Kpgp::Subkey::Subkey
Subkey(const KeyID &keyID, const bool secret=false)
Constructs a new subkey with the given key ID.
Definition: kpgpkey.cpp:65
QString::compare
int compare(const QString &other) const
Kpgp::Subkey::setCanEncrypt
void setCanEncrypt(const bool canEncrypt)
Sets the flag if the subkey can be used to encrypt data to canEncrypt .
Definition: kpgpkey.h:456
Kpgp::Key::setCanSign
void setCanSign(const bool canSign)
Sets the flag if the key can be used to sign data to canSign .
Definition: kpgpkey.h:757
Kpgp::Key::matchesUserID
bool matchesUserID(const QString &str, bool cs=true)
Returns true if the given string matches one of the user IDs.
Definition: kpgpkey.cpp:209
Kpgp::Key::getSubkey
Subkey * getSubkey(const KeyID &keyID)
Returns a pointer to the subkey with the given key ID.
Definition: kpgpkey.cpp:230
Kpgp::Key::mCanSign
bool mCanSign
Definition: kpgpkey.h:678
Kpgp::Subkey::setCreationDate
void setCreationDate(const time_t creationDate)
Sets the creation date of the subkey to creationDate seconds since Epoch.
Definition: kpgpkey.h:491
Kpgp::UserID::revoked
bool revoked() const
Returns true if the user id has been revoked.
Definition: kpgpkey.h:145
Kpgp::Key::isNull
bool isNull() const
Returns true if there are no user IDs or no subkeys.
Definition: kpgpkey.h:817
Kpgp::Key::clear
void clear()
Clears/resets all key data.
Definition: kpgpkey.cpp:117
Kpgp::Key::cloneKeyTrust
void cloneKeyTrust(const Key *key)
Set the validity values for the user ids to the validity values of the given key. ...
Definition: kpgpkey.cpp:168
Kpgp::Key::primaryKeyID
KeyID primaryKeyID() const
Returns the key ID of the primary key or a null string if there are no subkeys.
Definition: kpgpkey.h:787
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:22 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
  • pimprint

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