CKR_SESSION_READ_WRITE_SO_EXISTS (was: Athena IDProtect Troubles on C_login)

69 views
Skip to first unread message

Bernd

unread,
Jun 7, 2017, 5:25:08 PM6/7/17
to pkcs1...@googlegroups.com
Hello Jaroslav,

2017-06-03 23:14 GMT+02:00 Jaroslav Imrich <jarosla...@gmail.com>:
IMO only Athena can help you troubleshoot the issue.

Just a heads up, I actually received help: its a known issue in later Athema middleware and it helps to remove the card definition from Windows registry.

details: https://superuser.com/a/1216833/86524

Now I can use the token (with Pkcs11Admin) with no card selection popup from Windows.

I do struggle a bit with SO logins.Pkcs11Admin (after F5) tells me in basic information sessioncount = 0, rwsession count =0. (and I also termiated all other pkcs11 or csp apps I think).

I then use the Token -> Login -> SO and provide the PIN. It responds to that with operation in progress and closes the login like it was sucessful. If I then click on Certificates it gives me a red status bar "C_OpenSession returned CKR_SESSION_READ_WRITE_SO_EXISTS".and under basic info it tells me rw-count =1 r-count=1.

In the logfile I see it actualy opens and closes a RW session, gets some mech info and then tries to open it again, which strangely fails:

0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:13:56 ***
0x0000318c : 0x00003950 : Calling C_CloseSession
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  hSession: 1
0x0000318c : 0x00003950 : Returning 0 (CKR_OK)
0x0000318c : 0x00002ca4 : ****************************** 2017-06-07 23:14:07 ***
0x0000318c : 0x00002ca4 : Calling C_OpenSession
0x0000318c : 0x00002ca4 : Input
0x0000318c : 0x00002ca4 :  slotID: 0
0x0000318c : 0x00002ca4 :  flags: 6
0x0000318c : 0x00002ca4 :   CKF_RW_SESSION: TRUE
0x0000318c : 0x00002ca4 :   CKF_SERIAL_SESSION: TRUE
0x0000318c : 0x00002ca4 :  pApplication: 0000000000000000
0x0000318c : 0x00002ca4 :  Notify: 0000000000000000
0x0000318c : 0x00002ca4 :  phSession: 000000FCA5DFD620
0x0000318c : 0x00002ca4 :  *phSession: 2782909984
0x0000318c : 0x00002ca4 : Output
0x0000318c : 0x00002ca4 :  phSession: 000000FCA5DFD620
0x0000318c : 0x00002ca4 :  *phSession: 1
0x0000318c : 0x00002ca4 : Returning 0 (CKR_OK)
0x0000318c : 0x00002ca4 : ****************************** 2017-06-07 23:14:07 ***
0x0000318c : 0x00002ca4 : Calling C_Login
0x0000318c : 0x00002ca4 : Input
0x0000318c : 0x00002ca4 :  hSession: 1
0x0000318c : 0x00002ca4 :  userType: 0 (CKU_SO)
0x0000318c : 0x00002ca4 :  pPin: 000002CD9E002000
0x0000318c : 0x00002ca4 :  *pPin: *** Intentionally hidden ***
0x0000318c : 0x00002ca4 :  ulPinLen: 8
0x0000318c : 0x00002ca4 : Returning 0 (CKR_OK)
0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:14:08 ***
0x0000318c : 0x00003950 : Calling C_GetSlotInfo
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  slotID: 0
0x0000318c : 0x00003950 :  pInfo: 000000FCA99FF0B0
0x0000318c : 0x00003950 : Output
0x0000318c : 0x00003950 :  pInfo: 000000FCA99FF0B0
0x0000318c : 0x00003950 :   slotDescription: Athena IDProtect Key v2 0                                      
0x0000318c : 0x00003950 :   manufacturerID: Athena                         
0x0000318c : 0x00003950 :   flags: 7
0x0000318c : 0x00003950 :    CKF_TOKEN_PRESENT: TRUE
0x0000318c : 0x00003950 :    CKF_REMOVABLE_DEVICE: TRUE
0x0000318c : 0x00003950 :    CKF_HW_SLOT: TRUE
0x0000318c : 0x00003950 :   hardwareVersion:
0x0000318c : 0x00003950 :    major: 1
0x0000318c : 0x00003950 :    minor: 0
0x0000318c : 0x00003950 :   firmwareVersion:
0x0000318c : 0x00003950 :    major: 1
0x0000318c : 0x00003950 :    minor: 0
0x0000318c : 0x00003950 : Returning 0 (CKR_OK)
0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:14:08 ***
0x0000318c : 0x00003950 : Calling C_GetTokenInfo
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  slotID: 0
0x0000318c : 0x00003950 :  pInfo: 000000FCA99FEFA8
0x0000318c : 0x00003950 : Output
0x0000318c : 0x00003950 :  pInfo: 000000FCA99FEFA8
0x0000318c : 0x00003950 :   label: bernd                          
0x0000318c : 0x00003950 :   manufacturerID: NXP                            
0x0000318c : 0x00003950 :   model: IDProtect      
0x0000318c : 0x00003950 :   serialNumber: 0C50000614499845
0x0000318c : 0x00003950 :   flags: 263181
0x0000318c : 0x00003950 :    CKF_RNG: TRUE
0x0000318c : 0x00003950 :    CKF_WRITE_PROTECTED: FALSE
0x0000318c : 0x00003950 :    CKF_LOGIN_REQUIRED: TRUE
0x0000318c : 0x00003950 :    CKF_USER_PIN_INITIALIZED: TRUE
0x0000318c : 0x00003950 :    CKF_RESTORE_KEY_NOT_NEEDED: FALSE
0x0000318c : 0x00003950 :    CKF_CLOCK_ON_TOKEN: FALSE
0x0000318c : 0x00003950 :    CKF_PROTECTED_AUTHENTICATION_PATH: FALSE
0x0000318c : 0x00003950 :    CKF_DUAL_CRYPTO_OPERATIONS: FALSE
0x0000318c : 0x00003950 :    CKF_TOKEN_INITIALIZED: TRUE
0x0000318c : 0x00003950 :    CKF_SECONDARY_AUTHENTICATION: FALSE
0x0000318c : 0x00003950 :    CKF_USER_PIN_COUNT_LOW: FALSE
0x0000318c : 0x00003950 :    CKF_USER_PIN_FINAL_TRY: FALSE
0x0000318c : 0x00003950 :    CKF_USER_PIN_LOCKED: TRUE
0x0000318c : 0x00003950 :    CKF_USER_PIN_TO_BE_CHANGED: FALSE
0x0000318c : 0x00003950 :    CKF_SO_PIN_COUNT_LOW: FALSE
0x0000318c : 0x00003950 :    CKF_SO_PIN_FINAL_TRY: FALSE
0x0000318c : 0x00003950 :    CKF_SO_PIN_LOCKED: FALSE
0x0000318c : 0x00003950 :    CKF_SO_PIN_TO_BE_CHANGED: FALSE
0x0000318c : 0x00003950 :   ulMaxSessionCount: 1000
0x0000318c : 0x00003950 :   ulSessionCount: 1
0x0000318c : 0x00003950 :   ulMaxRwSessionCount: 1000
0x0000318c : 0x00003950 :   ulRwSessionCount: 1
0x0000318c : 0x00003950 :   ulMaxPinLen: 16
0x0000318c : 0x00003950 :   ulMinPinLen: 4
0x0000318c : 0x00003950 :   ulTotalPublicMemory: 4294967295
0x0000318c : 0x00003950 :   ulFreePublicMemory: 47594
0x0000318c : 0x00003950 :   ulTotalPrivateMemory: 4294967295
0x0000318c : 0x00003950 :   ulFreePrivateMemory: 47594
0x0000318c : 0x00003950 :   hardwareVersion:
0x0000318c : 0x00003950 :    major: 1
0x0000318c : 0x00003950 :    minor: 0
0x0000318c : 0x00003950 :   firmwareVersion:
0x0000318c : 0x00003950 :    major: 1
0x0000318c : 0x00003950 :    minor: 0
0x0000318c : 0x00003950 :   utcTime:
0x0000318c : 0x00003950 : Returning 0 (CKR_OK)
0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:14:08 ***
0x0000318c : 0x00003950 : Calling C_OpenSession
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  slotID: 0
0x0000318c : 0x00003950 :  flags: 6
0x0000318c : 0x00003950 :   CKF_RW_SESSION: TRUE
0x0000318c : 0x00003950 :   CKF_SERIAL_SESSION: TRUE
0x0000318c : 0x00003950 :  pApplication: 0000000000000000
0x0000318c : 0x00003950 :  Notify: 0000000000000000
0x0000318c : 0x00003950 :  phSession: 000000FCA99FF1D0
0x0000318c : 0x00003950 :  *phSession: 2845831632
0x0000318c : 0x00003950 : Output
0x0000318c : 0x00003950 :  phSession: 000000FCA99FF1D0
0x0000318c : 0x00003950 :  *phSession: 2
0x0000318c : 0x00003950 : Returning 0 (CKR_OK)
0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:14:08 ***
0x0000318c : 0x00003950 : Calling C_GetSessionInfo
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  hSession: 2
0x0000318c : 0x00003950 :  pInfo: 000000FCA99FF1C0
0x0000318c : 0x00003950 : Output
0x0000318c : 0x00003950 :  pInfo: 000000FCA99FF1C0
0x0000318c : 0x00003950 :   slotID: 0
0x0000318c : 0x00003950 :   state: 4 (CKS_RW_SO_FUNCTIONS)
0x0000318c : 0x00003950 :   flags: 6
0x0000318c : 0x00003950 :    CKF_RW_SESSION: TRUE
0x0000318c : 0x00003950 :    CKF_SERIAL_SESSION: TRUE
0x0000318c : 0x00003950 :   ulDeviceError: 0
0x0000318c : 0x00003950 : Returning 0 (CKR_OK)
0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:14:08 ***
0x0000318c : 0x00003950 : Calling C_CloseSession
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  hSession: 2
0x0000318c : 0x00003950 : Returning 0 (CKR_OK)
0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:14:08 ***
0x0000318c : 0x00003950 : Calling C_GetMechanismList
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  slotID: 0
0x0000318c : 0x00003950 :  pMechanismList: 0000000000000000
0x0000318c : 0x00003950 :  pulCount: 000000FCA99FF1F0
0x0000318c : 0x00003950 :  *pulCount: 0
0x0000318c : 0x00003950 : Output
0x0000318c : 0x00003950 :  pMechanismList: 0000000000000000
0x0000318c : 0x00003950 :  pulCount: 000000FCA99FF1F0
0x0000318c : 0x00003950 :  *pulCount: 42
0x0000318c : 0x00003950 : Returning 0 (CKR_OK)
0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:14:08 ***
0x0000318c : 0x00003950 : Calling C_GetMechanismList
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  slotID: 0
0x0000318c : 0x00003950 :  pMechanismList: 000002CD9E014B18
0x0000318c : 0x00003950 :  pulCount: 000000FCA99FF1F0
0x0000318c : 0x00003950 :  *pulCount: 42
0x0000318c : 0x00003950 : Output
0x0000318c : 0x00003950 :  pMechanismList: 000002CD9E014B18
0x0000318c : 0x00003950 :   pMechanismList[0]: 1 (CKM_RSA_PKCS)
0x0000318c : 0x00003950 :   pMechanismList[1]: 3 (CKM_RSA_X_509)
0x0000318c : 0x00003950 :   pMechanismList[2]: 6 (CKM_SHA1_RSA_PKCS)
0x0000318c : 0x00003950 :   pMechanismList[3]: 64 (CKM_SHA256_RSA_PKCS)
0x0000318c : 0x00003950 :   pMechanismList[4]: 65 (CKM_SHA384_RSA_PKCS)
0x0000318c : 0x00003950 :   pMechanismList[5]: 66 (CKM_SHA512_RSA_PKCS)
0x0000318c : 0x00003950 :   pMechanismList[6]: 5 (CKM_MD5_RSA_PKCS)
0x0000318c : 0x00003950 :   pMechanismList[7]: 9 (CKM_RSA_PKCS_OAEP)
0x0000318c : 0x00003950 :   pMechanismList[8]: 13 (CKM_RSA_PKCS_PSS)
0x0000318c : 0x00003950 :   pMechanismList[9]: 0 (CKM_RSA_PKCS_KEY_PAIR_GEN)
0x0000318c : 0x00003950 :   pMechanismList[10]: 288 (CKM_DES_KEY_GEN)
0x0000318c : 0x00003950 :   pMechanismList[11]: 304 (CKM_DES2_KEY_GEN)
0x0000318c : 0x00003950 :   pMechanismList[12]: 305 (CKM_DES3_KEY_GEN)
0x0000318c : 0x00003950 :   pMechanismList[13]: 289 (CKM_DES_ECB)
0x0000318c : 0x00003950 :   pMechanismList[14]: 306 (CKM_DES3_ECB)
0x0000318c : 0x00003950 :   pMechanismList[15]: 290 (CKM_DES_CBC)
0x0000318c : 0x00003950 :   pMechanismList[16]: 293 (CKM_DES_CBC_PAD)
0x0000318c : 0x00003950 :   pMechanismList[17]: 292 (CKM_DES_MAC_GENERAL)
0x0000318c : 0x00003950 :   pMechanismList[18]: 291 (CKM_DES_MAC)
0x0000318c : 0x00003950 :   pMechanismList[19]: 307 (CKM_DES3_CBC)
0x0000318c : 0x00003950 :   pMechanismList[20]: 310 (CKM_DES3_CBC_PAD)
0x0000318c : 0x00003950 :   pMechanismList[21]: 309 (CKM_DES3_MAC_GENERAL)
0x0000318c : 0x00003950 :   pMechanismList[22]: 308 (CKM_DES3_MAC)
0x0000318c : 0x00003950 :   pMechanismList[23]: 544 (CKM_SHA_1)
0x0000318c : 0x00003950 :   pMechanismList[24]: 545 (CKM_SHA_1_HMAC)
0x0000318c : 0x00003950 :   pMechanismList[25]: 528 (CKM_MD5)
0x0000318c : 0x00003950 :   pMechanismList[26]: 529 (CKM_MD5_HMAC)
0x0000318c : 0x00003950 :   pMechanismList[27]: 4224 (CKM_AES_KEY_GEN)
0x0000318c : 0x00003950 :   pMechanismList[28]: 4225 (CKM_AES_ECB)
0x0000318c : 0x00003950 :   pMechanismList[29]: 4226 (CKM_AES_CBC)
0x0000318c : 0x00003950 :   pMechanismList[30]: 4229 (CKM_AES_CBC_PAD)
0x0000318c : 0x00003950 :   pMechanismList[31]: 4227 (CKM_AES_MAC)
0x0000318c : 0x00003950 :   pMechanismList[32]: 4228 (CKM_AES_MAC_GENERAL)
0x0000318c : 0x00003950 :   pMechanismList[33]: 592 (CKM_SHA256)
0x0000318c : 0x00003950 :   pMechanismList[34]: 593 (CKM_SHA256_HMAC)
0x0000318c : 0x00003950 :   pMechanismList[35]: 608 (CKM_SHA384)
0x0000318c : 0x00003950 :   pMechanismList[36]: 609 (CKM_SHA384_HMAC)
0x0000318c : 0x00003950 :   pMechanismList[37]: 624 (CKM_SHA512)
0x0000318c : 0x00003950 :   pMechanismList[38]: 625 (CKM_SHA512_HMAC)
0x0000318c : 0x00003950 :   pMechanismList[39]: 4160 (CKM_ECDSA_KEY_PAIR_GEN or CKM_EC_KEY_PAIR_GEN)
0x0000318c : 0x00003950 :   pMechanismList[40]: 4161 (CKM_ECDSA)
0x0000318c : 0x00003950 :   pMechanismList[41]: 4176 (CKM_ECDH1_DERIVE)
0x0000318c : 0x00003950 :  pulCount: 000000FCA99FF1F0
0x0000318c : 0x00003950 :  *pulCount: 42
0x0000318c : 0x00003950 : Returning 0 (CKR_OK)
0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:14:08 ***
0x0000318c : 0x00003950 : Calling C_GetMechanismInfo
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  slotID: 0
0x0000318c : 0x00003950 :  type: 1 (CKM_RSA_PKCS)
... 42 times ok
0x0000318c : 0x00003950 : Returning 0 (CKR_OK)
0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:14:08 ***
0x0000318c : 0x00003950 : Calling C_OpenSession
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  slotID: 0
0x0000318c : 0x00003950 :  flags: 4
0x0000318c : 0x00003950 :   CKF_RW_SESSION: FALSE
0x0000318c : 0x00003950 :   CKF_SERIAL_SESSION: TRUE
0x0000318c : 0x00003950 :  pApplication: 0000000000000000
0x0000318c : 0x00003950 :  Notify: 0000000000000000
0x0000318c : 0x00003950 :  phSession: 000000FCA99FF160
0x0000318c : 0x00003950 :  *phSession: 2845831520
0x0000318c : 0x00003950 : Returning 184 (CKR_SESSION_READ_WRITE_SO_EXISTS)
0x0000318c : 0x00003950 : ****************************** 2017-06-07 23:14:08 ***
0x0000318c : 0x00003950 : Calling C_OpenSession
0x0000318c : 0x00003950 : Input
0x0000318c : 0x00003950 :  slotID: 0
0x0000318c : 0x00003950 :  flags: 4
0x0000318c : 0x00003950 :   CKF_RW_SESSION: FALSE
0x0000318c : 0x00003950 :   CKF_SERIAL_SESSION: TRUE
0x0000318c : 0x00003950 :  pApplication: 0000000000000000
0x0000318c : 0x00003950 :  Notify: 0000000000000000
0x0000318c : 0x00003950 :  phSession: 000000FCA99FF160
0x0000318c : 0x00003950 :  *phSession: 2845831520
0x0000318c : 0x00003950 : Returning 184 (CKR_SESSION_READ_WRITE_SO_EXISTS)

BTW: I could imagine it would be desireable to login without refreshing all tabs in SO mode without manual F5?

Gruss
Bernd

Jaroslav Imrich

unread,
Jun 11, 2017, 4:41:38 PM6/11/17
to pkcs1...@googlegroups.com, Bernd Eckenfels
Hello Bernd,

I then use the Token -> Login -> SO and provide the PIN. It responds to that with operation in progress and closes the login like it was sucessful. If I then click on Certificates it gives me a red status bar "C_OpenSession returned CKR_SESSION_READ_WRITE_SO_EXISTS".and under basic info it tells me rw-count =1 r-count=1.

That's a bug in Pkcs11Admin. RO sessions should not be opened when SO is logged in. I have created GitHub issue [0] to track this problem. Thanks for reporting!
BTW I did not catch this during the development because my Atos CardOS 5.3 middleware seems to be violating PKCS#11 spec by not returning CKR_SESSION_READ_WRITE_SO_EXISTS error.

Regards, Jaroslav
Reply all
Reply to author
Forward
0 new messages