Skip to content

Brand new Italian CNS (ACe 2021) not working: C_Login failed: rv = CKR_USER_PIN_NOT_INITIALIZED (0x102) #2445

@nestukh

Description

@nestukh

Hello I have a brand new Italian CNS ('Tessera Sanitaria', TS-CNS), the provider is ACe 2021 (official driver here). After rebuilding OpenSC from git cloning, on Linux (Debian Bullseye amd64) I'm still can't login via its PIN, I'm getting C_Login failed: rv = CKR_USER_PIN_NOT_INITIALIZED (0x102), in a similar way as described in #1995. I've rebuilt CCID too.
My previous TS-CNS smartcard had no problem with the same setup, but the provider was OT2015.

Logs:
the command (OpenSC built in $HOME/.bin/TS-CNS/static/)

$HOME/.bin/TS-CNS/static/bin/pkcs11-tool --login --test --module /home/$USER/.bin/TS-CNS/static/lib/opensc-pkcs11.so

results in

Using slot 0 with a present token (0x0)
error: PKCS11 function C_Login failed: rv = CKR_USER_PIN_NOT_INITIALIZED (0x102)
Aborting.

the full logs of
OPENSC_DEBUG=3 $HOME/.bin/TS-CNS/static/bin/pkcs11-tool --login --test --module /home/$USER/.bin/TS-CNS/static/lib/opensc-pkcs11.so
are here (some parts omitted for privacy): https://gist.github.com/nestukh/29ddd4e55f63bcb207e8f158d41a69d3

Using the official driver for this card (/usr/lib/bit4id/libbit4opki.so), the command

$HOME/.bin/TS-CNS/static/bin/pkcs11-tool --login --test --module /usr/lib/bit4id/libbit4opki.so

returns

Using slot 0 with a present token (0x0)
Logging in to "Carta Nazionale dei Servizi".
Please enter User PIN: 
C_SeedRandom() and C_GenerateRandom():
  seems to be OK
Digests:
  all 4 digest functions seem to work
  SHA-1: OK
  SHA256: OK
  ERR: C_Digest() didn't return CKR_BUFFER_TOO_SMALL but CKR_GENERAL_ERROR (0x5)
  ERR: C_Digest() didn't return CKR_OK for a NULL output buffer, but CKR_OPERATION_NOT_INITIALIZED (0x91)
  ERR: digest operation ended prematurely
Signatures (currently only for RSA)
  testing key 0 (CNS1) 
  ERR: C_SignUpdate failed: CKR_FUNCTION_FAILED (0x6)
  ERR: C_Sign() didn't return CKR_BUFFER_TOO_SMALL but CKR_GENERAL_ERROR (0x5)
  ERR: C_Sign() didn't return CKR_OK for a NULL output buf, but CKR_OPERATION_NOT_INITIALIZED (0x91)
error: PKCS11 function C_Sign failed: rv = CKR_GENERAL_ERROR (0x5)
Aborting.

the full log with OPENSC_DEBUG=3 doesn't differ (I don't know why)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions