File indexing completed on 2024-05-26 05:24:20

0001 /*
0002     defaultkeyfilter.cpp
0003 
0004     This file is part of libkleopatra, the KDE keymanagement library
0005     SPDX-FileCopyrightText: 2004 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik
0008     SPDX-FileContributor: Intevation GmbH
0009 
0010     SPDX-License-Identifier: GPL-2.0-or-later
0011 */
0012 
0013 #include <config-libkleo.h>
0014 
0015 #include "defaultkeyfilter.h"
0016 #include "utils/compliance.h"
0017 
0018 #if GPGMEPP_KEY_HAS_HASCERTIFY_SIGN_ENCRYPT_AUTHENTICATE
0019 #else
0020 #include <libkleo/compat.h>
0021 #endif
0022 #include <libkleo/compliance.h>
0023 #include <libkleo/formatting.h>
0024 #include <libkleo/keyhelpers.h>
0025 
0026 #include <functional>
0027 
0028 using namespace GpgME;
0029 using namespace Kleo;
0030 
0031 static bool is_card_key(const Key &key)
0032 {
0033     const std::vector<Subkey> sks = key.subkeys();
0034     return std::find_if(sks.begin(), sks.end(), std::mem_fn(&Subkey::isCardKey)) != sks.end();
0035 }
0036 
0037 class DefaultKeyFilter::Private
0038 {
0039 public:
0040     Private()
0041     {
0042     }
0043 
0044     QColor mFgColor;
0045     QColor mBgColor;
0046     QString mName;
0047     QString mIcon;
0048     QString mId;
0049     MatchContexts mMatchContexts = AnyMatchContext;
0050     unsigned int mSpecificity = 0;
0051     bool mItalic = false;
0052     bool mBold = false;
0053     bool mStrikeOut = false;
0054     bool mUseFullFont = false;
0055     QFont mFont;
0056 
0057     TriState mRevoked = DoesNotMatter;
0058     TriState mExpired = DoesNotMatter;
0059     TriState mInvalid = DoesNotMatter;
0060     TriState mDisabled = DoesNotMatter;
0061     TriState mRoot = DoesNotMatter;
0062     TriState mCanEncrypt = DoesNotMatter;
0063     TriState mCanSign = DoesNotMatter;
0064     TriState mCanCertify = DoesNotMatter;
0065     TriState mCanAuthenticate = DoesNotMatter;
0066     TriState mHasEncrypt = DoesNotMatter;
0067     TriState mHasSign = DoesNotMatter;
0068     TriState mHasCertify = DoesNotMatter;
0069     TriState mHasAuthenticate = DoesNotMatter;
0070     TriState mQualified = DoesNotMatter;
0071     TriState mCardKey = DoesNotMatter;
0072     TriState mHasSecret = DoesNotMatter;
0073     TriState mIsOpenPGP = DoesNotMatter;
0074     TriState mWasValidated = DoesNotMatter;
0075     TriState mIsDeVs = DoesNotMatter;
0076     TriState mBad = DoesNotMatter;
0077     TriState mValidIfSMIME = DoesNotMatter;
0078 
0079     LevelState mOwnerTrust = LevelDoesNotMatter;
0080     GpgME::Key::OwnerTrust mOwnerTrustReferenceLevel = Key::OwnerTrust::Unknown;
0081     LevelState mValidity = LevelDoesNotMatter;
0082     GpgME::UserID::Validity mValidityReferenceLevel = UserID::Validity::Unknown;
0083 };
0084 
0085 DefaultKeyFilter::DefaultKeyFilter()
0086     : KeyFilter{}
0087     , d{new Private}
0088 {
0089 }
0090 
0091 DefaultKeyFilter::~DefaultKeyFilter() = default;
0092 
0093 bool DefaultKeyFilter::matches(const Key &key, MatchContexts contexts) const
0094 {
0095     if (!(d->mMatchContexts & contexts)) {
0096         return false;
0097     }
0098 #ifdef MATCH
0099 #undef MATCH
0100 #endif
0101 #define MATCH(member, method)                                                                                                                                  \
0102     do {                                                                                                                                                       \
0103         if (member != DoesNotMatter && key.method() != bool(member == Set)) {                                                                                  \
0104             return false;                                                                                                                                      \
0105         }                                                                                                                                                      \
0106     } while (false)
0107 #define IS_MATCH(what) MATCH(d->m##what, is##what)
0108 #define CAN_MATCH(what) MATCH(d->mCan##what, can##what)
0109 #if GPGMEPP_KEY_HAS_HASCERTIFY_SIGN_ENCRYPT_AUTHENTICATE
0110 #define HAS_MATCH(what) MATCH(d->mHas##what, has##what)
0111 #else
0112 #define HAS_MATCH(what)                                                                                                                                        \
0113     do {                                                                                                                                                       \
0114         if (d->mHas##what != DoesNotMatter && Kleo::keyHas##what(key) != bool(d->mHas##what == Set)) {                                                         \
0115             return false;                                                                                                                                      \
0116         }                                                                                                                                                      \
0117     } while (false)
0118 #endif
0119     IS_MATCH(Revoked);
0120     IS_MATCH(Expired);
0121     IS_MATCH(Invalid);
0122     IS_MATCH(Disabled);
0123     IS_MATCH(Root);
0124     CAN_MATCH(Encrypt);
0125     CAN_MATCH(Sign);
0126     CAN_MATCH(Certify);
0127     CAN_MATCH(Authenticate);
0128     HAS_MATCH(Encrypt);
0129     HAS_MATCH(Sign);
0130     HAS_MATCH(Certify);
0131     HAS_MATCH(Authenticate);
0132     IS_MATCH(Qualified);
0133     if (d->mCardKey != DoesNotMatter) {
0134         if ((d->mCardKey == Set && !is_card_key(key)) || (d->mCardKey == NotSet && is_card_key(key))) {
0135             return false;
0136         }
0137     }
0138     MATCH(d->mHasSecret, hasSecret);
0139 #undef MATCH
0140     if (d->mIsOpenPGP != DoesNotMatter && bool(key.protocol() == GpgME::OpenPGP) != bool(d->mIsOpenPGP == Set)) {
0141         return false;
0142     }
0143     if (d->mWasValidated != DoesNotMatter && bool(key.keyListMode() & GpgME::Validate) != bool(d->mWasValidated == Set)) {
0144         return false;
0145     }
0146     if (d->mIsDeVs != DoesNotMatter && bool(DeVSCompliance::keyIsCompliant(key)) != bool(d->mIsDeVs == Set)) {
0147         return false;
0148     }
0149     if (d->mBad != DoesNotMatter &&
0150         /* This is similar to GPGME::Key::isBad which was introduced in GPGME 1.13.0 */
0151         bool(key.isNull() || key.isRevoked() || key.isExpired() || key.isDisabled() || key.isInvalid()) != bool(d->mBad == Set)) {
0152         return false;
0153     }
0154     const UserID uid = key.userID(0);
0155     if ((key.protocol() == GpgME::CMS) //
0156         && (d->mValidIfSMIME != DoesNotMatter) //
0157         && (bool(uid.validity() >= UserID::Full) != bool(d->mValidIfSMIME == Set))) {
0158         return false;
0159     }
0160     switch (d->mOwnerTrust) {
0161     default:
0162     case LevelDoesNotMatter:
0163         break;
0164     case Is:
0165         if (key.ownerTrust() != d->mOwnerTrustReferenceLevel) {
0166             return false;
0167         }
0168         break;
0169     case IsNot:
0170         if (key.ownerTrust() == d->mOwnerTrustReferenceLevel) {
0171             return false;
0172         }
0173         break;
0174     case IsAtLeast:
0175         if (static_cast<int>(key.ownerTrust()) < static_cast<int>(d->mOwnerTrustReferenceLevel)) {
0176             return false;
0177         }
0178         break;
0179     case IsAtMost:
0180         if (static_cast<int>(key.ownerTrust()) > static_cast<int>(d->mOwnerTrustReferenceLevel)) {
0181             return false;
0182         }
0183         break;
0184     }
0185     switch (d->mValidity) {
0186     default:
0187     case LevelDoesNotMatter:
0188         break;
0189     case Is:
0190         if (uid.validity() != d->mValidityReferenceLevel) {
0191             return false;
0192         }
0193         break;
0194     case IsNot:
0195         if (uid.validity() == d->mValidityReferenceLevel) {
0196             return false;
0197         }
0198         break;
0199     case IsAtLeast:
0200         if (static_cast<int>(uid.validity()) < static_cast<int>(d->mValidityReferenceLevel)) {
0201             return false;
0202         }
0203         break;
0204     case IsAtMost:
0205         if (static_cast<int>(uid.validity()) > static_cast<int>(d->mValidityReferenceLevel)) {
0206             return false;
0207         }
0208         break;
0209     }
0210     return true;
0211 }
0212 
0213 bool DefaultKeyFilter::matches(const UserID &userID, MatchContexts contexts) const
0214 {
0215     if (!(d->mMatchContexts & contexts)) {
0216         return false;
0217     }
0218 #ifdef MATCH_KEY
0219 #undef MATCH_KEY
0220 #endif
0221 #define MATCH_KEY(member, method)                                                                                                                              \
0222     do {                                                                                                                                                       \
0223         if (member != DoesNotMatter && userID.parent().method() != bool(member == Set)) {                                                                      \
0224             return false;                                                                                                                                      \
0225         }                                                                                                                                                      \
0226     } while (false)
0227 #define IS_MATCH_KEY(what) MATCH_KEY(d->m##what, is##what)
0228 #define CAN_MATCH_KEY(what) MATCH_KEY(d->mCan##what, can##what)
0229 #if GPGMEPP_KEY_HAS_HASCERTIFY_SIGN_ENCRYPT_AUTHENTICATE
0230 #define HAS_MATCH_KEY(what) MATCH_KEY(d->mHas##what, has##what)
0231 #else
0232 #define HAS_MATCH_KEY(what)                                                                                                                                    \
0233     do {                                                                                                                                                       \
0234         if (d->mHas##what != DoesNotMatter && Kleo::keyHas##what(userID.parent()) != bool(d->mHas##what == Set)) {                                             \
0235             return false;                                                                                                                                      \
0236         }                                                                                                                                                      \
0237     } while (false)
0238 #endif
0239 
0240 #ifdef MATCH
0241 #undef MATCH
0242 #endif
0243 #define MATCH(member, method)                                                                                                                                  \
0244     do {                                                                                                                                                       \
0245         if (member != DoesNotMatter && (userID.parent().method() != bool(member == Set) || userID.method() != bool(member == Set))) {                          \
0246             return false;                                                                                                                                      \
0247         }                                                                                                                                                      \
0248     } while (false)
0249 #define IS_MATCH(what) MATCH(d->m##what, is##what)
0250     IS_MATCH(Revoked);
0251     IS_MATCH_KEY(Expired);
0252     // We have to do this manually since there's no UserID::isExpired()
0253     if (d->mExpired != DoesNotMatter && (userID.parent().isExpired() != bool(d->mExpired == Set) || isExpired(userID) != bool(d->mExpired == Set))) {
0254         return false;
0255     }
0256     IS_MATCH(Invalid);
0257     IS_MATCH_KEY(Disabled);
0258     IS_MATCH_KEY(Root);
0259     CAN_MATCH_KEY(Encrypt);
0260     CAN_MATCH_KEY(Sign);
0261     CAN_MATCH_KEY(Certify);
0262     CAN_MATCH_KEY(Authenticate);
0263     HAS_MATCH_KEY(Encrypt);
0264     HAS_MATCH_KEY(Sign);
0265     HAS_MATCH_KEY(Certify);
0266     HAS_MATCH_KEY(Authenticate);
0267     IS_MATCH_KEY(Qualified);
0268     if (d->mCardKey != DoesNotMatter) {
0269         if ((d->mCardKey == Set && !is_card_key(userID.parent())) || (d->mCardKey == NotSet && is_card_key(userID.parent()))) {
0270             return false;
0271         }
0272     }
0273     MATCH_KEY(d->mHasSecret, hasSecret);
0274 #undef MATCH
0275     if (d->mIsOpenPGP != DoesNotMatter && bool(userID.parent().protocol() == GpgME::OpenPGP) != bool(d->mIsOpenPGP == Set)) {
0276         return false;
0277     }
0278     if (d->mWasValidated != DoesNotMatter && bool(userID.parent().keyListMode() & GpgME::Validate) != bool(d->mWasValidated == Set)) {
0279         return false;
0280     }
0281     if (d->mIsDeVs != DoesNotMatter && bool(DeVSCompliance::userIDIsCompliant(userID)) != bool(d->mIsDeVs == Set)) {
0282         return false;
0283     }
0284     if (d->mBad != DoesNotMatter &&
0285         /* This is similar to GPGME::Key::isBad which was introduced in GPGME 1.13.0 */
0286         bool(userID.parent().isNull() || userID.isNull() || userID.parent().isRevoked() || userID.isRevoked() || userID.parent().isExpired()
0287              || userID.parent().isDisabled() || userID.parent().isInvalid() || userID.isInvalid())
0288             != bool(d->mBad == Set)) {
0289         return false;
0290     }
0291     if ((userID.parent().protocol() == GpgME::CMS) //
0292         && (d->mValidIfSMIME != DoesNotMatter) //
0293         && (bool(userID.validity() >= UserID::Full) != bool(d->mValidIfSMIME == Set))) {
0294         return false;
0295     }
0296     switch (d->mOwnerTrust) {
0297     default:
0298     case LevelDoesNotMatter:
0299         break;
0300     case Is:
0301         if (userID.parent().ownerTrust() != d->mOwnerTrustReferenceLevel) {
0302             return false;
0303         }
0304         break;
0305     case IsNot:
0306         if (userID.parent().ownerTrust() == d->mOwnerTrustReferenceLevel) {
0307             return false;
0308         }
0309         break;
0310     case IsAtLeast:
0311         if (static_cast<int>(userID.parent().ownerTrust()) < static_cast<int>(d->mOwnerTrustReferenceLevel)) {
0312             return false;
0313         }
0314         break;
0315     case IsAtMost:
0316         if (static_cast<int>(userID.parent().ownerTrust()) > static_cast<int>(d->mOwnerTrustReferenceLevel)) {
0317             return false;
0318         }
0319         break;
0320     }
0321     switch (d->mValidity) {
0322     default:
0323     case LevelDoesNotMatter:
0324         break;
0325     case Is:
0326         if (userID.validity() != d->mValidityReferenceLevel) {
0327             return false;
0328         }
0329         break;
0330     case IsNot:
0331         if (userID.validity() == d->mValidityReferenceLevel) {
0332             return false;
0333         }
0334         break;
0335     case IsAtLeast:
0336         if (static_cast<int>(userID.validity()) < static_cast<int>(d->mValidityReferenceLevel)) {
0337             return false;
0338         }
0339         break;
0340     case IsAtMost:
0341         if (static_cast<int>(userID.validity()) > static_cast<int>(d->mValidityReferenceLevel)) {
0342             return false;
0343         }
0344         break;
0345     }
0346     return true;
0347 }
0348 
0349 KeyFilter::FontDescription DefaultKeyFilter::fontDescription() const
0350 {
0351     if (d->mUseFullFont) {
0352         return FontDescription::create(font(), bold(), italic(), strikeOut());
0353     } else {
0354         return FontDescription::create(bold(), italic(), strikeOut());
0355     }
0356 }
0357 
0358 void DefaultKeyFilter::setFgColor(const QColor &value)
0359 {
0360     d->mFgColor = value;
0361 }
0362 
0363 void DefaultKeyFilter::setBgColor(const QColor &value)
0364 {
0365     d->mBgColor = value;
0366 }
0367 
0368 void DefaultKeyFilter::setName(const QString &value)
0369 {
0370     d->mName = value;
0371 }
0372 
0373 void DefaultKeyFilter::setIcon(const QString &value)
0374 {
0375     d->mIcon = value;
0376 }
0377 
0378 void DefaultKeyFilter::setId(const QString &value)
0379 {
0380     d->mId = value;
0381 }
0382 
0383 void DefaultKeyFilter::setMatchContexts(MatchContexts value)
0384 {
0385     d->mMatchContexts = value;
0386 }
0387 
0388 void DefaultKeyFilter::setSpecificity(unsigned int value)
0389 {
0390     d->mSpecificity = value;
0391 }
0392 
0393 void DefaultKeyFilter::setItalic(bool value)
0394 {
0395     d->mItalic = value;
0396 }
0397 
0398 void DefaultKeyFilter::setBold(bool value)
0399 {
0400     d->mBold = value;
0401 }
0402 
0403 void DefaultKeyFilter::setStrikeOut(bool value)
0404 {
0405     d->mStrikeOut = value;
0406 }
0407 
0408 void DefaultKeyFilter::setUseFullFont(bool value)
0409 {
0410     d->mUseFullFont = value;
0411 }
0412 
0413 void DefaultKeyFilter::setFont(const QFont &value)
0414 {
0415     d->mFont = value;
0416 }
0417 
0418 void DefaultKeyFilter::setRevoked(DefaultKeyFilter::TriState value)
0419 {
0420     d->mRevoked = value;
0421 }
0422 
0423 void DefaultKeyFilter::setExpired(DefaultKeyFilter::TriState value)
0424 {
0425     d->mExpired = value;
0426 }
0427 
0428 void DefaultKeyFilter::setInvalid(DefaultKeyFilter::TriState value)
0429 {
0430     d->mInvalid = value;
0431 }
0432 
0433 void DefaultKeyFilter::setDisabled(DefaultKeyFilter::TriState value)
0434 {
0435     d->mDisabled = value;
0436 }
0437 
0438 void DefaultKeyFilter::setRoot(DefaultKeyFilter::TriState value)
0439 {
0440     d->mRoot = value;
0441 }
0442 
0443 void DefaultKeyFilter::setCanEncrypt(DefaultKeyFilter::TriState value)
0444 {
0445     d->mCanEncrypt = value;
0446 }
0447 
0448 void DefaultKeyFilter::setCanSign(DefaultKeyFilter::TriState value)
0449 {
0450     d->mCanSign = value;
0451 }
0452 
0453 void DefaultKeyFilter::setCanCertify(DefaultKeyFilter::TriState value)
0454 {
0455     d->mCanCertify = value;
0456 }
0457 
0458 void DefaultKeyFilter::setCanAuthenticate(DefaultKeyFilter::TriState value)
0459 {
0460     d->mCanAuthenticate = value;
0461 }
0462 
0463 void DefaultKeyFilter::setHasEncrypt(DefaultKeyFilter::TriState value)
0464 {
0465     d->mHasEncrypt = value;
0466 }
0467 
0468 void DefaultKeyFilter::setHasSign(DefaultKeyFilter::TriState value)
0469 {
0470     d->mHasSign = value;
0471 }
0472 
0473 void DefaultKeyFilter::setHasCertify(DefaultKeyFilter::TriState value)
0474 {
0475     d->mHasCertify = value;
0476 }
0477 
0478 void DefaultKeyFilter::setHasAuthenticate(DefaultKeyFilter::TriState value)
0479 {
0480     d->mHasAuthenticate = value;
0481 }
0482 
0483 void DefaultKeyFilter::setQualified(DefaultKeyFilter::TriState value)
0484 {
0485     d->mQualified = value;
0486 }
0487 
0488 void DefaultKeyFilter::setCardKey(DefaultKeyFilter::TriState value)
0489 {
0490     d->mCardKey = value;
0491 }
0492 
0493 void DefaultKeyFilter::setHasSecret(DefaultKeyFilter::TriState value)
0494 {
0495     d->mHasSecret = value;
0496 }
0497 
0498 void DefaultKeyFilter::setIsOpenPGP(DefaultKeyFilter::TriState value)
0499 {
0500     d->mIsOpenPGP = value;
0501 }
0502 
0503 void DefaultKeyFilter::setWasValidated(DefaultKeyFilter::TriState value)
0504 {
0505     d->mWasValidated = value;
0506 }
0507 
0508 void DefaultKeyFilter::setOwnerTrust(DefaultKeyFilter::LevelState value)
0509 {
0510     d->mOwnerTrust = value;
0511 }
0512 
0513 void DefaultKeyFilter::setOwnerTrustReferenceLevel(GpgME::Key::OwnerTrust value)
0514 {
0515     d->mOwnerTrustReferenceLevel = value;
0516 }
0517 
0518 void DefaultKeyFilter::setValidity(DefaultKeyFilter::LevelState value)
0519 {
0520     d->mValidity = value;
0521 }
0522 
0523 void DefaultKeyFilter::setValidityReferenceLevel(GpgME::UserID::Validity value)
0524 {
0525     d->mValidityReferenceLevel = value;
0526 }
0527 
0528 void DefaultKeyFilter::setIsDeVs(DefaultKeyFilter::TriState value)
0529 {
0530     d->mIsDeVs = value;
0531 }
0532 
0533 void DefaultKeyFilter::setIsBad(DefaultKeyFilter::TriState value)
0534 {
0535     d->mBad = value;
0536 }
0537 
0538 void DefaultKeyFilter::setValidIfSMIME(DefaultKeyFilter::TriState value)
0539 {
0540     d->mValidIfSMIME = value;
0541 }
0542 
0543 QColor DefaultKeyFilter::fgColor() const
0544 {
0545     return d->mFgColor;
0546 }
0547 
0548 QColor DefaultKeyFilter::bgColor() const
0549 {
0550     return d->mBgColor;
0551 }
0552 
0553 QString DefaultKeyFilter::name() const
0554 {
0555     return d->mName;
0556 }
0557 
0558 QString DefaultKeyFilter::icon() const
0559 {
0560     return d->mIcon;
0561 }
0562 
0563 QString DefaultKeyFilter::id() const
0564 {
0565     return d->mId;
0566 }
0567 
0568 QFont DefaultKeyFilter::font() const
0569 {
0570     return d->mFont;
0571 }
0572 
0573 KeyFilter::MatchContexts DefaultKeyFilter::availableMatchContexts() const
0574 {
0575     return d->mMatchContexts;
0576 }
0577 
0578 unsigned int DefaultKeyFilter::specificity() const
0579 {
0580     return d->mSpecificity;
0581 }
0582 
0583 bool DefaultKeyFilter::italic() const
0584 {
0585     return d->mItalic;
0586 }
0587 
0588 bool DefaultKeyFilter::bold() const
0589 {
0590     return d->mBold;
0591 }
0592 
0593 bool DefaultKeyFilter::strikeOut() const
0594 {
0595     return d->mStrikeOut;
0596 }
0597 
0598 bool DefaultKeyFilter::useFullFont() const
0599 {
0600     return d->mUseFullFont;
0601 }
0602 
0603 DefaultKeyFilter::TriState DefaultKeyFilter::revoked() const
0604 {
0605     return d->mRevoked;
0606 }
0607 
0608 DefaultKeyFilter::TriState DefaultKeyFilter::expired() const
0609 {
0610     return d->mExpired;
0611 }
0612 
0613 DefaultKeyFilter::TriState DefaultKeyFilter::invalid() const
0614 {
0615     return d->mInvalid;
0616 }
0617 
0618 DefaultKeyFilter::TriState DefaultKeyFilter::disabled() const
0619 {
0620     return d->mDisabled;
0621 }
0622 
0623 DefaultKeyFilter::TriState DefaultKeyFilter::root() const
0624 {
0625     return d->mRoot;
0626 }
0627 
0628 DefaultKeyFilter::TriState DefaultKeyFilter::canEncrypt() const
0629 {
0630     return d->mCanEncrypt;
0631 }
0632 
0633 DefaultKeyFilter::TriState DefaultKeyFilter::canSign() const
0634 {
0635     return d->mCanSign;
0636 }
0637 
0638 DefaultKeyFilter::TriState DefaultKeyFilter::canCertify() const
0639 {
0640     return d->mCanCertify;
0641 }
0642 
0643 DefaultKeyFilter::TriState DefaultKeyFilter::canAuthenticate() const
0644 {
0645     return d->mCanAuthenticate;
0646 }
0647 
0648 DefaultKeyFilter::TriState DefaultKeyFilter::hasEncrypt() const
0649 {
0650     return d->mHasEncrypt;
0651 }
0652 
0653 DefaultKeyFilter::TriState DefaultKeyFilter::hasSign() const
0654 {
0655     return d->mHasSign;
0656 }
0657 
0658 DefaultKeyFilter::TriState DefaultKeyFilter::hasCertify() const
0659 {
0660     return d->mHasCertify;
0661 }
0662 
0663 DefaultKeyFilter::TriState DefaultKeyFilter::hasAuthenticate() const
0664 {
0665     return d->mHasAuthenticate;
0666 }
0667 
0668 DefaultKeyFilter::TriState DefaultKeyFilter::qualified() const
0669 {
0670     return d->mQualified;
0671 }
0672 
0673 DefaultKeyFilter::TriState DefaultKeyFilter::cardKey() const
0674 {
0675     return d->mCardKey;
0676 }
0677 
0678 DefaultKeyFilter::TriState DefaultKeyFilter::hasSecret() const
0679 {
0680     return d->mHasSecret;
0681 }
0682 
0683 DefaultKeyFilter::TriState DefaultKeyFilter::isOpenPGP() const
0684 {
0685     return d->mIsOpenPGP;
0686 }
0687 
0688 DefaultKeyFilter::TriState DefaultKeyFilter::wasValidated() const
0689 {
0690     return d->mWasValidated;
0691 }
0692 
0693 DefaultKeyFilter::LevelState DefaultKeyFilter::ownerTrust() const
0694 {
0695     return d->mOwnerTrust;
0696 }
0697 
0698 GpgME::Key::OwnerTrust DefaultKeyFilter::ownerTrustReferenceLevel() const
0699 {
0700     return d->mOwnerTrustReferenceLevel;
0701 }
0702 
0703 DefaultKeyFilter::LevelState DefaultKeyFilter::validity() const
0704 {
0705     return d->mValidity;
0706 }
0707 
0708 GpgME::UserID::Validity DefaultKeyFilter::validityReferenceLevel() const
0709 {
0710     return d->mValidityReferenceLevel;
0711 }
0712 
0713 DefaultKeyFilter::TriState DefaultKeyFilter::isDeVS() const
0714 {
0715     return d->mIsDeVs;
0716 }
0717 
0718 DefaultKeyFilter::TriState DefaultKeyFilter::isBad() const
0719 {
0720     return d->mBad;
0721 }
0722 
0723 DefaultKeyFilter::TriState DefaultKeyFilter::validIfSMIME() const
0724 {
0725     return d->mValidIfSMIME;
0726 }