libp11 icon indicating copy to clipboard operation
libp11 copied to clipboard

User not logged in after logging in

Open mihaicristiantanase opened this issue 1 year ago • 8 comments

I have an issue with key pair generation. This simplified code:

void runSimplifiedTest(char* lib, char* passwd)
{
	PKCS11_CTX* ctx = PKCS11_CTX_new();
	PKCS11_CTX_load(ctx, lib);

	PKCS11_SLOT* slots = NULL;
	unsigned int nslots;
	PKCS11_enumerate_slots(ctx, &slots, &nslots);
	PKCS11_SLOT* slot = PKCS11_find_token(ctx, slots, nslots);

	PKCS11_login(slot, 0, passwd);

	PKCS11_open_session(slot, 1);
	PKCS11_login(slot, 0, passwd);
	PKCS11_generate_key(slot->token, 0, 2048, "test_label", (unsigned char*)"testid", 6);
	if (ERR_peek_last_error()) {
		fprintf(stderr, "Generated errors:\n");
		ERR_print_errors_fp(stderr);
	}
}

shows the following error: 4407954944:error:81082101:PKCS#11 module:func(130):User not logged in:p11_key.c:322:

mihaicristiantanase avatar Nov 14 '23 12:11 mihaicristiantanase