8#include <QRegularExpression>
24 if (record_type ==
"pub") {
27 if (record_type ==
"sec") {
30 if (record_type ==
"uid") {
33 if (record_type ==
"fpr") {
36 if (record_type ==
"sub") {
39 if (record_type ==
"ssb") {
42 if (record_type ==
"grp") {
65 bool okCreated =
false;
68 current_user.
created.setSecsSinceEpoch(createdSecs);
71 bool okExpiry =
false;
74 current_user.
expiry.setSecsSinceEpoch(expirySecs);
98 if (!current_user.
key_id.isEmpty() &&
112 QList<UserInfo> users;
114#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
115 const QStringList lines =
118 const QStringList lines =
124 for (
const QString &key : lines) {
125 QStringList props = key.split(
':');
130 const QString record_type = props[0];
136 if (!current_user.
key_id.isEmpty()) {
137 users.append(current_user);
144 if (current_user.
name.isEmpty()) {
156 if (!current_user.
key_id.isEmpty()) {
157 users.append(current_user);
static auto newLinesRegex() -> const QRegularExpression &
Returns a regex to match newline characters.
void handlePubSecRecord(const QStringList &props, bool secret, UserInfo ¤t_user)
Handle a pub or sec record in GPG colon output.
auto parseGpgColonOutput(const QString &output, bool secret) -> QList< UserInfo >
Parse GPG –with-colons output into a list of UserInfo.
constexpr int GPG_FIELD_KEY_ID
constexpr int GPG_FIELD_VALIDITY
constexpr int GPG_FIELD_EXPIRY
constexpr int GPG_FIELD_CREATED
constexpr int GPG_MIN_FIELDS
auto classifyRecord(const QString &record_type) -> GpgRecordType
Classify a GPG colon output record type.
void handleFprRecord(const QStringList &props, UserInfo ¤t_user)
Handle an fpr (fingerprint) record in GPG colon output.
void handleUidRecord(const QStringList &props, UserInfo ¤t_user)
Handle a uid record in GPG colon output.
constexpr int GPG_FIELD_USERID
Stores key info lines including validity, creation date and more.
bool have_secret
UserInfo::have_secret whether secret key is available (can decrypt with this key).
QString key_id
UserInfo::key_id hexadecimal representation of the GnuPG key identifier.
QDateTime created
UserInfo::created date/time when key was created.
QString name
UserInfo::name GPG user ID / full name.
char validity
UserInfo::validity GnuPG representation of validity http://git.gnupg.org/cgi-bin/gitweb....
QDateTime expiry
UserInfo::expiry date/time when key expires.