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 <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-03-30 17:27:42 +02:00
parent 9c5c7c6f60
commit c5c21a0646
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 5 additions and 0 deletions

View File

@ -318,6 +318,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;