Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is force_login supposed to prompt user to re-enter their PIN? #535

Open
totszwai opened this issue Jun 21, 2024 · 1 comment
Open

Is force_login supposed to prompt user to re-enter their PIN? #535

totszwai opened this issue Jun 21, 2024 · 1 comment
Labels

Comments

@totszwai
Copy link

https://github.com/OpenSC/libp11/blob/master/src/eng_back.c#L211

Looking at the code, if force_login is set, and they are already logged in, it just returns true.

Shouldn't we force it to log out first if force_login is enabled?

+	if (ctx->force_login && slot_logged_in(ctx, slot))
+        	PKCS11_logout(slot);
+
 	if (!(ctx->force_login || tok->loginRequired) || slot_logged_in(ctx, slot))
 		return 1;
@olszomal
Copy link
Contributor

According to the PKCS #11 Cryptographic Token Interface Base Specification Version 3.0, the CK_TOKEN_INFO structure includes the CKF_LOGIN_REQUIRED flag, which is set to True if there are cryptographic operations that require the user to be logged in.

However, some tokens do not have the CKF_LOGIN_REQUIRED flag set. In these cases, providing the token PIN via the PIN command fails, while entering it interactively when prompted by the engine works correctly.

The FORCE_LOGIN command can enforce a login to the token when the CKF_LOGIN_REQUIRED flag is not set.

In my opinion, enforcing a logout is unnecessary in this case. I recommend closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants