28 TQStringList KeyIDList::toStringList()
const 31 for( KeyIDList::ConstIterator it = begin(); it != end(); ++it ) {
39 KeyIDList KeyIDList::fromStringList(
const TQStringList& l )
42 for( TQStringList::ConstIterator it = l.begin(); it != l.end(); ++it ) {
43 res << (*it).local8Bit();
51 const bool revoked,
const bool invalid)
84 Key::Key(
const KeyID& keyid,
const TQString& uid,
const bool secret) :
85 mSubkeys(), mUserIDs()
101 mEncryptPref = UnknownEncryptPref;
107 mUserIDs.setAutoDelete(
true);
109 mSubkeys.setAutoDelete(
true);
125 mEncryptPref = UnknownEncryptPref;
127 mSubkeys.setAutoDelete(
true);
129 mUserIDs.setAutoDelete(
true);
136 Validity trust = KPGP_VALIDITY_UNKNOWN;
138 for( UserIDListIterator it(mUserIDs); it.current(); ++it )
140 if( (*it)->validity() > trust )
141 trust = (*it)->validity();
150 Validity trust = KPGP_VALIDITY_UNKNOWN;
155 for( UserIDListIterator it(mUserIDs); it.current(); ++it )
157 if( (*it)->text() == uid )
158 trust = (*it)->validity();
170 for( UserIDListIterator it(mUserIDs); it.current(); ++it )
172 (*it)->setValidity( key->
keyTrust( (*it)->text() ) );
179 return ( !mRevoked && !mExpired && !mDisabled && !mInvalid );
186 return ( !mRevoked && !mExpired && !mDisabled && !mInvalid && mCanEncrypt );
193 return ( !mRevoked && !mExpired && !mDisabled && !mInvalid && mCanSign );
200 if (!uid.isEmpty()) {
201 UserID *userID =
new UserID(uid, validity, revoked, invalid);
202 mUserIDs.append(userID);
208 if (str.isEmpty() || mUserIDs.isEmpty())
211 for (UserIDListIterator it(mUserIDs); it.current(); ++it) {
212 if (((*it)->text().find(str, 0, cs)) != -1)
221 if (!keyID.isEmpty()) {
223 mSubkeys.append(key);
229 if (keyID.isEmpty() || mSubkeys.isEmpty())
233 bool longKeyID = (keyID.length() == 16);
235 for (SubkeyListIterator it(mSubkeys); it.current(); ++it) {
237 if ((*it)->longKeyID() == keyID)
241 if ((*it)->keyID() == keyID)
256 kdDebug(5006) <<
"Error: Can't set fingerprint. A subkey with key ID 0x" 257 << keyID <<
" doesn't exist." << endl;
bool matchesUserID(const TQString &str, bool cs=true)
Returns true if the given string matches one of the user IDs.
bool isValidEncryptionKey() const
Returns true if the key is a valid encryption key.
void setFingerprint(const KeyID &keyID, const TQCString &fpr)
Sets the fingerprint of the given subkey to fpr.
Key(const KeyID &keyid=KeyID(), const TQString &uid=TQString(), const bool secret=false)
Constructs a new PGP key with keyid as key ID of the primary key and uid as primary user ID...
bool isValid() const
Returns true if the key is valid, i.e.
bool invalid() const
Returns true if the key is invalid.
void setFingerprint(const TQCString &fingerprint)
Sets the fingerprint of the subkey to fingerprint.
bool revoked() const
Returns true if the key has been revoked.
bool secret() const
Returns true if the key is a secret key.
This class is used to store information about a subkey of a PGP key.
bool invalid() const
Returns true if the user id is invalid.
Validity keyTrust() const
Returns the trust value of this key.
This class is used to store information about a user id of a PGP key.
bool isValidSigningKey() const
Returns true if the key is a valid signing key.
void addUserID(const TQString &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.
Validity validity() const
Returns the validity of resp.
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.
UserID(const TQString &str, const Validity validity=KPGP_VALIDITY_UNKNOWN, const bool revoked=false, const bool invalid=false)
Constructs a new user id with the given values.
This class is used to store information about a PGP key.
Subkey(const KeyID &keyID, const bool secret=false)
Constructs a new subkey with the given key ID.
Subkey * getSubkey(const KeyID &keyID)
Returns a pointer to the subkey with the given key ID.
bool revoked() const
Returns true if the user id has been revoked.
void clear()
Clears/resets all key data.
void cloneKeyTrust(const Key *key)
Set the validity values for the user ids to the validity values of the given key. ...