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

C_Login for PKCS11 slot 1 failed. (CKR_USER_ANOTHER_ALREADY_LOGGED_IN) #4

Open
EduardoDiNizo opened this issue Jun 23, 2017 · 0 comments

Comments

@EduardoDiNizo
Copy link

When I try to perform my tests I get this exception. Does anyone know how to solve this?

------------------ Code -------------------------------------------------------------------------------------
BouncyCastleProvider bcProvider = new BouncyCastleProvider();
Security.addProvider(bcProvider);
Connection connection = null;
try {
connection = new Connection();
} catch (IOException e) {
e.printStackTrace();
}
KeyStore ks = KeyStore.getInstance("PKCS11", "OpenSC-PKCS11");
PKCS11LoadStoreParameter params = new PKCS11LoadStoreParameter(); params.setSOProtectionPIN("0000".toCharArray());
params.setProtectionPIN("0000".toCharArray());

    PKCS11SessionStore sessionStore = new PKCS11SessionStore();
    sessionStore.open(connection.getProvider(),params);
    System.out.println(sessionStore.getSession().isUserLoggedIn());

    ks.load(params);

------------------ Error -------------------------------------------------------------------------------------
Found provider: SUN
Found provider: SunRsaSign
Found provider: SunEC
Found provider: SunJSSE
Found provider: SunJCE
Found provider: SunJGSS
Found provider: SunSASL
Found provider: XMLDSig
Found provider: SunPCSC
Found provider: BC
Found provider: OpenSC-PKCS11
Exception in thread "main" org.opensc.pkcs11.wrap.PKCS11Exception: C_Login for PKCS11 slot 1 failed. (CKR_USER_ANOTHER_ALREADY_LOGGED_IN)
at org.opensc.pkcs11.wrap.PKCS11Session.loginNative(Native Method)
at org.opensc.pkcs11.wrap.PKCS11Session.loginUser(PKCS11Session.java:146)
at org.opensc.pkcs11.PKCS11SessionStore.authenticate(PKCS11SessionStore.java:350)
at org.opensc.pkcs11.PKCS11SessionStore.open(PKCS11SessionStore.java:291)
at org.opensc.test.pkcs11.tests.SaveCertificate.main(SaveCertificate.java:93)

CKR_USER_ANOTHER_ALREADY_LOGGED_IN: This value can only be returned by C_Login. It indicates that the specified user cannot be logged into the session, because another user is already logged into the session. For example, if an application has an open SO session, and it attempts to log the normal user into it, it will receive this error code.

http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/os/pkcs11-base-v2.40-os.html#_Toc416959688

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

No branches or pull requests

1 participant