You can specify default keys which are tried against each device
(after more specific keys fail), eg:
tool --key :key:defaultkey1 --key :key:defaultkey2
which would try "defaultkey1" and "defaultkey2" against all devices
in the guest.
---
options/keys.c | 3 ++-
options/options.h | 5 ++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/options/keys.c b/options/keys.c
index 782bdb6..817508b 100644
--- a/options/keys.c
+++ b/options/keys.c
@@ -148,7 +148,8 @@ get_keys (struct key_store *ks, const char *device)
for (i = 0; i < ks->nr_keys; ++i) {
struct key_store_key *key = &ks->keys[i];
- if (STRNEQ (key->device, device))
+ if (STRNEQ (key->device, "") &&
+ STRNEQ (key->device, device))
continue;
switch (key->type) {
diff --git a/options/options.h b/options/options.h
index 510e8a8..2f6bc5c 100644
--- a/options/options.h
+++ b/options/options.h
@@ -105,7 +105,10 @@ struct mp {
/* A key in the key store. */
struct key_store_key {
/* The device this key refers to. There may be multiple matching
- * devices in the list.
+ * devices in the list. It is never NULL but it may also be ""
+ * which is interpreted as a default key which is tried after any
+ * device-specific keys (there may be multiple defaults in the
+ * list).
*/
char *device;
--
2.23.0