Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kleopatra
Commits
82d5bbb8
Commit
82d5bbb8
authored
Aug 05, 2022
by
Ingo Klöcker
Browse files
Add helper to check that a user ID belongs to a key
GnuPG-bug-id: 6115
parent
16cf9a3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/utils/keys.cpp
View file @
82d5bbb8
...
...
@@ -115,3 +115,8 @@ bool Kleo::userCanRevokeCertifications(const GpgME::UserID &userId)
return
userCanRevokeCertification
(
certification
)
==
CertificationCanBeRevoked
;
});
}
bool
Kleo
::
userIDBelongsToKey
(
const
GpgME
::
UserID
&
userID
,
const
GpgME
::
Key
&
key
)
{
return
!
qstricmp
(
userID
.
parent
().
primaryFingerprint
(),
key
.
primaryFingerprint
());
}
src/utils/keys.h
View file @
82d5bbb8
...
...
@@ -88,4 +88,19 @@ CertificationRevocationFeasibility userCanRevokeCertification(const GpgME::UserI
*/
bool
userCanRevokeCertifications
(
const
GpgME
::
UserID
&
userId
);
/**
* Returns true, if the user ID \p userID belongs to the key \p key.
*/
bool
userIDBelongsToKey
(
const
GpgME
::
UserID
&
userID
,
const
GpgME
::
Key
&
key
);
/**
* Returns a unary predicate to check if a user ID belongs to the key \p key.
*/
inline
auto
userIDBelongsToKey
(
const
GpgME
::
Key
&
key
)
{
return
[
key
](
const
GpgME
::
UserID
&
userID
)
{
return
userIDBelongsToKey
(
userID
,
key
);
};
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment