1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-09-20 14:51:42 +02:00

Logout after use (when login).

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-02-24 13:27:50 +09:00
parent c0a5dd3dcf
commit 88b832dfab
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -637,15 +637,18 @@ learn_keys (struct token *token)
unsigned long err = 0; unsigned long err = 0;
int i; int i;
/* Detect private keys on the token. */ /* Detect private keys on the token.
* It's good if it also offers raw public key material.
*/
detect_private_keys (token); detect_private_keys (token);
/* /*
* In some implementations (EC key on SoftHSMv2, for example), * In some implementations (EC key on SoftHSMv2, for example),
* public key is not available in CKO_PRIVATE_KEY objects. * attributes for raw public key material is not available in
* a CKO_PRIVATE_KEY object.
* *
* So, try to examine CKO_PUBLIC_KEY objects, if it provides * We try to examine CKO_PUBLIC_KEY objects, too see if it provides
* public keys. * raw public key material in a CKO_PUBLIC_KEY object.
*/ */
check_public_keys (token); check_public_keys (token);
@ -658,6 +661,8 @@ learn_keys (struct token *token)
} }
#if 0 #if 0
/* Another way to get raw public key material is get it from the
certificate, if available. */
get_certificate (token); get_certificate (token);
#endif #endif
@ -801,7 +806,7 @@ main (int argc, const char *argv[])
} }
/* XXX: Support each PIN for each token. */ /* XXX: Support each PIN for each token. */
if (pin) if (token->login_required && pin)
login (token, pin, pin_len); login (token, pin, pin_len);
puts ("************"); puts ("************");
@ -842,6 +847,9 @@ main (int argc, const char *argv[])
{ {
struct token *token = &ck->token_list[i]; struct token *token = &ck->token_list[i];
if (token->valid && token->login_required && pin)
logout (token);
close_session (token); close_session (token);
} }