From 011a2f5fb77c7963f25550e423160507818f7a91 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 30 Mar 2020 17:27:42 +0200 Subject: [PATCH] agent: Print an error if gpg-protect reads the extended key format. * agent/protect-tool.c (read_key): Detect simple extended key format. -- This is a quick hack to get a useful error messages. The real fix is to replace the protect tool by a more useful new tool. Signed-off-by: Werner Koch --- agent/protect-tool.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/agent/protect-tool.c b/agent/protect-tool.c index 3bba5c6ba..00c0748e1 100644 --- a/agent/protect-tool.c +++ b/agent/protect-tool.c @@ -316,6 +316,11 @@ read_key (const char *fname) buf = read_file (fname, &buflen); if (!buf) return NULL; + if (buflen >= 4 && !memcmp (buf, "Key:", 4)) + { + log_error ("Extended key format is not supported by this tool\n"); + return NULL; + } key = make_canonical (fname, buf, buflen); xfree (buf); return key;