core: New keylist mode GPGME_KEYLIST_MODE_WITH_KEYGRIP.
* src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_KEYGRIP): New. * src/gpgme-json.c (op_keylist): New flag "keygrip". * src/engine-gpg.c (gpg_keylist_build_options): Pass the options. * lang/cpp/src/global.h (WithKeygrip): New. * lang/cpp/src/context.cpp: Add check. * lang/cpp/src/key.cpp (Key::update): Handle WithKeygrip. * lang/cpp/src/verificationresult.cpp: Ditto. * lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t): Ditto. -- GnuPG-bug-id: 4939 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
32b80cf3c7
commit
c8048bf8eb
3
NEWS
3
NEWS
@ -1,6 +1,8 @@
|
|||||||
Noteworthy changes in version 1.14.0 (unreleased)
|
Noteworthy changes in version 1.14.0 (unreleased)
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
|
* New keylist mode to force the engine to return the keygrip. [#4820]
|
||||||
|
|
||||||
* New context flag "extended-edit" to enable expert key edit. [#4734]
|
* New context flag "extended-edit" to enable expert key edit. [#4734]
|
||||||
|
|
||||||
* cpp: Add convenience API to obtain remarks. [#4734]
|
* cpp: Add convenience API to obtain remarks. [#4734]
|
||||||
@ -18,6 +20,7 @@ Noteworthy changes in version 1.14.0 (unreleased)
|
|||||||
|
|
||||||
* Interface changes relative to the 1.13.1 release:
|
* Interface changes relative to the 1.13.1 release:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
GPGME_KEYLIST_MODE_WITH_KEYGRIP NEW.
|
||||||
gpgme_user_id_t EXTENDED: New field 'uidhash'.
|
gpgme_user_id_t EXTENDED: New field 'uidhash'.
|
||||||
cpp: UserID::remark NEW.
|
cpp: UserID::remark NEW.
|
||||||
cpp: UserID::remarks NEW.
|
cpp: UserID::remarks NEW.
|
||||||
|
@ -2820,6 +2820,13 @@ The @code{GPGME_KEYLIST_MODE_WITH_TOFU} symbol specifies that
|
|||||||
information pertaining to the TOFU trust model should be included in
|
information pertaining to the TOFU trust model should be included in
|
||||||
the listed keys.
|
the listed keys.
|
||||||
|
|
||||||
|
@item GPGME_KEYLIST_MODE_WITH_KEYGRIP
|
||||||
|
@since{1.14.0}
|
||||||
|
|
||||||
|
The @code{GPGME_KEYLIST_MODE_WITH_KEYRIP} symbol specifies that the
|
||||||
|
keygrip is always included in the listing. The default depends on the
|
||||||
|
version of the backend and the used protocol.
|
||||||
|
|
||||||
@item GPGME_KEYLIST_MODE_WITH_SECRET
|
@item GPGME_KEYLIST_MODE_WITH_SECRET
|
||||||
@since{1.5.1}
|
@since{1.5.1}
|
||||||
|
|
||||||
|
@ -1615,6 +1615,7 @@ std::ostream &operator<<(std::ostream &os, KeyListMode mode)
|
|||||||
CHECK(Validate);
|
CHECK(Validate);
|
||||||
CHECK(Ephemeral);
|
CHECK(Ephemeral);
|
||||||
CHECK(WithTofu);
|
CHECK(WithTofu);
|
||||||
|
CHECK(WithKeygrip);
|
||||||
#undef CHECK
|
#undef CHECK
|
||||||
return os << ')';
|
return os << ')';
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,8 @@ enum KeyListMode {
|
|||||||
SignatureNotations = 0x8,
|
SignatureNotations = 0x8,
|
||||||
Validate = 0x10,
|
Validate = 0x10,
|
||||||
Ephemeral = 0x20,
|
Ephemeral = 0x20,
|
||||||
WithTofu = 0x40
|
WithTofu = 0x40,
|
||||||
|
WithKeygrip = 0x80
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SignatureMode { NormalSignatureMode, Detached, Clearsigned };
|
enum SignatureMode { NormalSignatureMode, Detached, Clearsigned };
|
||||||
|
@ -358,7 +358,8 @@ void Key::update()
|
|||||||
KeyListMode::Signatures |
|
KeyListMode::Signatures |
|
||||||
KeyListMode::SignatureNotations |
|
KeyListMode::SignatureNotations |
|
||||||
KeyListMode::Validate |
|
KeyListMode::Validate |
|
||||||
KeyListMode::WithTofu);
|
KeyListMode::WithTofu |
|
||||||
|
KeyListMode::WithKeygrip);
|
||||||
Error err;
|
Error err;
|
||||||
auto newKey = ctx->key(primaryFingerprint(), err, true);
|
auto newKey = ctx->key(primaryFingerprint(), err, true);
|
||||||
// Not secret so we get the information from the pubring.
|
// Not secret so we get the information from the pubring.
|
||||||
|
@ -81,6 +81,9 @@ static inline gpgme_keylist_mode_t add_to_gpgme_keylist_mode_t(unsigned int oldm
|
|||||||
if (newmodes & GpgME::WithTofu) {
|
if (newmodes & GpgME::WithTofu) {
|
||||||
oldmode |= GPGME_KEYLIST_MODE_WITH_TOFU;
|
oldmode |= GPGME_KEYLIST_MODE_WITH_TOFU;
|
||||||
}
|
}
|
||||||
|
if (newmodes & GpgME::WithKeygrip) {
|
||||||
|
oldmode |= GPGME_KEYLIST_MODE_WITH_KEYGRIP;
|
||||||
|
}
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (newmodes & ~(GpgME::Local | GpgME::Extern | GpgME::Signatures | GpgME::SignatureNotations | GpgME::Ephemeral | GpgME::Validate)) {
|
if (newmodes & ~(GpgME::Local | GpgME::Extern | GpgME::Signatures | GpgME::SignatureNotations | GpgME::Ephemeral | GpgME::Validate)) {
|
||||||
//std::cerr << "GpgME::Context: keylist mode must be one of Local, "
|
//std::cerr << "GpgME::Context: keylist mode must be one of Local, "
|
||||||
|
@ -413,7 +413,8 @@ GpgME::Key GpgME::Signature::key(bool search, bool update) const
|
|||||||
KeyListMode::Signatures |
|
KeyListMode::Signatures |
|
||||||
KeyListMode::SignatureNotations |
|
KeyListMode::SignatureNotations |
|
||||||
KeyListMode::Validate |
|
KeyListMode::Validate |
|
||||||
KeyListMode::WithTofu);
|
KeyListMode::WithTofu |
|
||||||
|
KeyListMode::WithKeygrip);
|
||||||
Error e;
|
Error e;
|
||||||
ret = d->keys[idx] = ctx->key(fingerprint(), e, false);
|
ret = d->keys[idx] = ctx->key(fingerprint(), e, false);
|
||||||
delete ctx;
|
delete ctx;
|
||||||
|
@ -3001,6 +3001,11 @@ gpg_keylist_build_options (engine_gpg_t gpg, int secret_only,
|
|||||||
err = add_arg (gpg, "--with-secret");
|
err = add_arg (gpg, "--with-secret");
|
||||||
err = add_arg (gpg, "--with-keygrip");
|
err = add_arg (gpg, "--with-keygrip");
|
||||||
}
|
}
|
||||||
|
else if (!err && (mode & GPGME_KEYLIST_MODE_WITH_KEYGRIP))
|
||||||
|
{
|
||||||
|
/* Explicitly requests the keygrip. */
|
||||||
|
err = add_arg (gpg, "--with-keygrip");
|
||||||
|
}
|
||||||
|
|
||||||
if (!err
|
if (!err
|
||||||
&& (mode & GPGME_KEYLIST_MODE_SIGS)
|
&& (mode & GPGME_KEYLIST_MODE_SIGS)
|
||||||
|
@ -2298,6 +2298,7 @@ static const char hlp_keylist[] =
|
|||||||
"sigs: Add KEYLIST_MODE_SIGS.\n"
|
"sigs: Add KEYLIST_MODE_SIGS.\n"
|
||||||
"notations: Add KEYLIST_MODE_SIG_NOTATIONS.\n"
|
"notations: Add KEYLIST_MODE_SIG_NOTATIONS.\n"
|
||||||
"tofu: Add KEYLIST_MODE_WITH_TOFU.\n"
|
"tofu: Add KEYLIST_MODE_WITH_TOFU.\n"
|
||||||
|
"keygrip: Add KEYLIST_MODE_WITH_KEYGRIP.\n"
|
||||||
"ephemeral: Add KEYLIST_MODE_EPHEMERAL.\n"
|
"ephemeral: Add KEYLIST_MODE_EPHEMERAL.\n"
|
||||||
"validate: Add KEYLIST_MODE_VALIDATE.\n"
|
"validate: Add KEYLIST_MODE_VALIDATE.\n"
|
||||||
"locate: Add KEYLIST_MODE_LOCATE.\n"
|
"locate: Add KEYLIST_MODE_LOCATE.\n"
|
||||||
@ -2463,6 +2464,11 @@ op_keylist (cjson_t request, cjson_t result)
|
|||||||
if (abool)
|
if (abool)
|
||||||
mode |= GPGME_KEYLIST_MODE_WITH_TOFU;
|
mode |= GPGME_KEYLIST_MODE_WITH_TOFU;
|
||||||
|
|
||||||
|
if ((err = get_boolean_flag (request, "keygrip", 0, &abool)))
|
||||||
|
goto leave;
|
||||||
|
if (abool)
|
||||||
|
mode |= GPGME_KEYLIST_MODE_WITH_KEYGRIP;
|
||||||
|
|
||||||
if ((err = get_boolean_flag (request, "ephemeral", 0, &abool)))
|
if ((err = get_boolean_flag (request, "ephemeral", 0, &abool)))
|
||||||
goto leave;
|
goto leave;
|
||||||
if (abool)
|
if (abool)
|
||||||
|
@ -379,6 +379,7 @@ gpgme_protocol_t;
|
|||||||
#define GPGME_KEYLIST_MODE_SIG_NOTATIONS 8
|
#define GPGME_KEYLIST_MODE_SIG_NOTATIONS 8
|
||||||
#define GPGME_KEYLIST_MODE_WITH_SECRET 16
|
#define GPGME_KEYLIST_MODE_WITH_SECRET 16
|
||||||
#define GPGME_KEYLIST_MODE_WITH_TOFU 32
|
#define GPGME_KEYLIST_MODE_WITH_TOFU 32
|
||||||
|
#define GPGME_KEYLIST_MODE_WITH_KEYGRIP 64
|
||||||
#define GPGME_KEYLIST_MODE_EPHEMERAL 128
|
#define GPGME_KEYLIST_MODE_EPHEMERAL 128
|
||||||
#define GPGME_KEYLIST_MODE_VALIDATE 256
|
#define GPGME_KEYLIST_MODE_VALIDATE 256
|
||||||
|
|
||||||
@ -600,7 +601,7 @@ struct _gpgme_subkey
|
|||||||
/* The name of the curve for ECC algorithms or NULL. */
|
/* The name of the curve for ECC algorithms or NULL. */
|
||||||
char *curve;
|
char *curve;
|
||||||
|
|
||||||
/* The keygrip of the subkey in hex digit form or NULL if not availabale. */
|
/* The keygrip of the subkey in hex digit form or NULL if not available. */
|
||||||
char *keygrip;
|
char *keygrip;
|
||||||
};
|
};
|
||||||
typedef struct _gpgme_subkey *gpgme_subkey_t;
|
typedef struct _gpgme_subkey *gpgme_subkey_t;
|
||||||
|
Loading…
Reference in New Issue
Block a user