Closed hinhmd closed 7 years ago
I am guessing that you have entered those 3 commands into cmd
window. Did you run application that was using pkcs11-logger from exactly the same cmd
window?
Yes, I did. But it is not better.
Please use set PKCS11_LOGGER_FLAGS=16
so the messages are displayed to STDOUT and then paste the output here.
It might also help if you could describe your environment in more detail - what kind of PKCS#11 library are you using, what kind of application is loading PKCS#11 library, application/library platform (x86 or x64) etc.
I am using SoftHSMv2, Console application x86.
Here output:
0x00000964 : 0x00000874 : Environment variable PKCS11_LOGGER_LIBRARY_PATH is not defined
I've tried to replicate your problem:
I've downloaded pkcs11-logger-x86.dll and saved it into d:\pkcs11-logger
directory.
I've downloaded SoftHSM 2.2.0 MSI installer and installed it into d:\SoftHSM2
directory.
I've initialized first SoftHSM2 token:
d:\SoftHSM2\bin>softhsm2-util.exe --init-token --slot 0 --label "My token 1"
=== SO PIN (4-255 characters) ===
Please enter SO PIN: **********
Please reenter SO PIN: **********
=== User PIN (4-255 characters) ===
Please enter user PIN: ********
Please reenter user PIN: ********
The token has been initialized.
softhsm2-util.exe
with PKCS#11 library softhsm2.dll
to show all available slots:d:\SoftHSM2\bin>softhsm2-util.exe --module d:\SoftHSM2\lib\softhsm2.dll --show-slots
Available slots:
Slot 1557603878
Slot info:
Description: SoftHSM slot ID 0x5cd72626
Manufacturer ID: SoftHSM project
Hardware version: 2.2
Firmware version: 2.2
Token present: yes
Token info:
Manufacturer ID: SoftHSM project
Model: SoftHSM v2
Hardware version: 2.2
Firmware version: 2.2
Serial number: e74a6404dcd72626
Initialized: yes
User PIN init.: yes
Label: My token 1
Slot 1
Slot info:
Description: SoftHSM slot ID 0x1
Manufacturer ID: SoftHSM project
Hardware version: 2.2
Firmware version: 2.2
Token present: yes
Token info:
Manufacturer ID: SoftHSM project
Model: SoftHSM v2
Hardware version: 2.2
Firmware version: 2.2
Serial number:
Initialized: no
User PIN init.: no
Label:
d:\SoftHSM2\bin>set PKCS11_LOGGER_LIBRARY_PATH=d:\SoftHSM2\lib\softhsm2.dll
d:\SoftHSM2\bin>set PKCS11_LOGGER_FLAGS=16
d:\SoftHSM2\bin>softhsm2-util.exe --module d:\pkcs11-logger\pkcs11-logger-x86.dll --show-slots
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:13 ***
0x00002450 : 0x00001060 : PKCS11-LOGGER 2.2.0
0x00002450 : 0x00001060 : PKCS#11 logging proxy module
0x00002450 : 0x00001060 : Developed as a part of the Pkcs11Interop project
0x00002450 : 0x00001060 : Please visit www.pkcs11interop.net for more information
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:13 ***
0x00002450 : 0x00001060 : Successfuly loaded d:\SoftHSM2\lib\softhsm2.dll
0x00002450 : 0x00001060 : Memory contents are dumped without endianness conversion
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:13 ***
0x00002450 : 0x00001060 : Calling C_GetFunctionList
0x00002450 : 0x00001060 : Input
0x00002450 : 0x00001060 : ppFunctionList: 0030E708
0x00002450 : 0x00001060 : Output
0x00002450 : 0x00001060 : Note: Returning function list of PKCS11-LOGGER
0x00002450 : 0x00001060 : Returning 0 (CKR_OK)
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:13 ***
0x00002450 : 0x00001060 : Calling C_Initialize
0x00002450 : 0x00001060 : Input
0x00002450 : 0x00001060 : pInitArgs: 00000000
0x00002450 : 0x00001060 : Returning 0 (CKR_OK)
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:13 ***
0x00002450 : 0x00001060 : Calling C_GetSlotList
0x00002450 : 0x00001060 : Input
0x00002450 : 0x00001060 : tokenPresent: 0
0x00002450 : 0x00001060 : pSlotList: 00000000
0x00002450 : 0x00001060 : pulCount: 007BF604
0x00002450 : 0x00001060 : *pulCount: 1969163344
0x00002450 : 0x00001060 : Output
0x00002450 : 0x00001060 : pSlotList: 00000000
0x00002450 : 0x00001060 : pulCount: 007BF604
0x00002450 : 0x00001060 : *pulCount: 2
0x00002450 : 0x00001060 : Returning 0 (CKR_OK)
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:14 ***
0x00002450 : 0x00001060 : Calling C_GetSlotList
0x00002450 : 0x00001060 : Input
0x00002450 : 0x00001060 : tokenPresent: 0
0x00002450 : 0x00001060 : pSlotList: 003D3440
0x00002450 : 0x00001060 : pulCount: 007BF604
0x00002450 : 0x00001060 : *pulCount: 2
0x00002450 : 0x00001060 : Output
0x00002450 : 0x00001060 : pSlotList: 003D3440
0x00002450 : 0x00001060 : pSlotList[0]: 1557603878
0x00002450 : 0x00001060 : pSlotList[1]: 1
0x00002450 : 0x00001060 : pulCount: 007BF604
0x00002450 : 0x00001060 : *pulCount: 2
0x00002450 : 0x00001060 : Returning 0 (CKR_OK)
Available slots:
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:14 ***
0x00002450 : 0x00001060 : Calling C_GetSlotInfo
0x00002450 : 0x00001060 : Input
0x00002450 : 0x00001060 : slotID: 1557603878
0x00002450 : 0x00001060 : pInfo: 007BF6A8
0x00002450 : 0x00001060 : Output
0x00002450 : 0x00001060 : pInfo: 007BF6A8
0x00002450 : 0x00001060 : slotDescription: SoftHSM slot ID 0x5cd72626
0x00002450 : 0x00001060 : manufacturerID: SoftHSM project
0x00002450 : 0x00001060 : flags: 1
0x00002450 : 0x00001060 : CKF_TOKEN_PRESENT: TRUE
0x00002450 : 0x00001060 : CKF_REMOVABLE_DEVICE: FALSE
0x00002450 : 0x00001060 : CKF_HW_SLOT: FALSE
0x00002450 : 0x00001060 : hardwareVersion:
0x00002450 : 0x00001060 : major: 2
0x00002450 : 0x00001060 : minor: 2
0x00002450 : 0x00001060 : firmwareVersion:
0x00002450 : 0x00001060 : major: 2
0x00002450 : 0x00001060 : minor: 2
0x00002450 : 0x00001060 : Returning 0 (CKR_OK)
Slot 1557603878
Slot info:
Description: SoftHSM slot ID 0x5cd72626
Manufacturer ID: SoftHSM project
Hardware version: 2.2
Firmware version: 2.2
Token present: yes
Token info:
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:14 ***
0x00002450 : 0x00001060 : Calling C_GetTokenInfo
0x00002450 : 0x00001060 : Input
0x00002450 : 0x00001060 : slotID: 1557603878
0x00002450 : 0x00001060 : pInfo: 007BF608
0x00002450 : 0x00001060 : Output
0x00002450 : 0x00001060 : pInfo: 007BF608
0x00002450 : 0x00001060 : label: My token 1
0x00002450 : 0x00001060 : manufacturerID: SoftHSM project
0x00002450 : 0x00001060 : model: SoftHSM v2
0x00002450 : 0x00001060 : serialNumber: e74a6404dcd72626
0x00002450 : 0x00001060 : flags: 1069
0x00002450 : 0x00001060 : CKF_RNG: TRUE
0x00002450 : 0x00001060 : CKF_WRITE_PROTECTED: FALSE
0x00002450 : 0x00001060 : CKF_LOGIN_REQUIRED: TRUE
0x00002450 : 0x00001060 : CKF_USER_PIN_INITIALIZED: TRUE
0x00002450 : 0x00001060 : CKF_RESTORE_KEY_NOT_NEEDED: TRUE
0x00002450 : 0x00001060 : CKF_CLOCK_ON_TOKEN: FALSE
0x00002450 : 0x00001060 : CKF_PROTECTED_AUTHENTICATION_PATH: FALSE
0x00002450 : 0x00001060 : CKF_DUAL_CRYPTO_OPERATIONS: FALSE
0x00002450 : 0x00001060 : CKF_TOKEN_INITIALIZED: TRUE
0x00002450 : 0x00001060 : CKF_SECONDARY_AUTHENTICATION: FALSE
0x00002450 : 0x00001060 : CKF_USER_PIN_COUNT_LOW: FALSE
0x00002450 : 0x00001060 : CKF_USER_PIN_FINAL_TRY: FALSE
0x00002450 : 0x00001060 : CKF_USER_PIN_LOCKED: FALSE
0x00002450 : 0x00001060 : CKF_USER_PIN_TO_BE_CHANGED: FALSE
0x00002450 : 0x00001060 : CKF_SO_PIN_COUNT_LOW: FALSE
0x00002450 : 0x00001060 : CKF_SO_PIN_FINAL_TRY: FALSE
0x00002450 : 0x00001060 : CKF_SO_PIN_LOCKED: FALSE
0x00002450 : 0x00001060 : CKF_SO_PIN_TO_BE_CHANGED: FALSE
0x00002450 : 0x00001060 : ulMaxSessionCount: 0
0x00002450 : 0x00001060 : ulSessionCount: 4294967295
0x00002450 : 0x00001060 : ulMaxRwSessionCount: 0
0x00002450 : 0x00001060 : ulRwSessionCount: 4294967295
0x00002450 : 0x00001060 : ulMaxPinLen: 255
0x00002450 : 0x00001060 : ulMinPinLen: 4
0x00002450 : 0x00001060 : ulTotalPublicMemory: 4294967295
0x00002450 : 0x00001060 : ulFreePublicMemory: 4294967295
0x00002450 : 0x00001060 : ulTotalPrivateMemory: 4294967295
0x00002450 : 0x00001060 : ulFreePrivateMemory: 4294967295
0x00002450 : 0x00001060 : hardwareVersion:
0x00002450 : 0x00001060 : major: 2
0x00002450 : 0x00001060 : minor: 2
0x00002450 : 0x00001060 : firmwareVersion:
0x00002450 : 0x00001060 : major: 2
0x00002450 : 0x00001060 : minor: 2
0x00002450 : 0x00001060 : utcTime: 2017063022061400
0x00002450 : 0x00001060 : Returning 0 (CKR_OK)
Manufacturer ID: SoftHSM project
Model: SoftHSM v2
Hardware version: 2.2
Firmware version: 2.2
Serial number: e74a6404dcd72626
Initialized: yes
User PIN init.: yes
Label: My token 1
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:14 ***
0x00002450 : 0x00001060 : Calling C_GetSlotInfo
0x00002450 : 0x00001060 : Input
0x00002450 : 0x00001060 : slotID: 1
0x00002450 : 0x00001060 : pInfo: 007BF6A8
0x00002450 : 0x00001060 : Output
0x00002450 : 0x00001060 : pInfo: 007BF6A8
0x00002450 : 0x00001060 : slotDescription: SoftHSM slot ID 0x1
0x00002450 : 0x00001060 : manufacturerID: SoftHSM project
0x00002450 : 0x00001060 : flags: 1
0x00002450 : 0x00001060 : CKF_TOKEN_PRESENT: TRUE
0x00002450 : 0x00001060 : CKF_REMOVABLE_DEVICE: FALSE
0x00002450 : 0x00001060 : CKF_HW_SLOT: FALSE
0x00002450 : 0x00001060 : hardwareVersion:
0x00002450 : 0x00001060 : major: 2
0x00002450 : 0x00001060 : minor: 2
0x00002450 : 0x00001060 : firmwareVersion:
0x00002450 : 0x00001060 : major: 2
0x00002450 : 0x00001060 : minor: 2
0x00002450 : 0x00001060 : Returning 0 (CKR_OK)
Slot 1
Slot info:
Description: SoftHSM slot ID 0x1
Manufacturer ID: SoftHSM project
Hardware version: 2.2
Firmware version: 2.2
Token present: yes
Token info:
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:14 ***
0x00002450 : 0x00001060 : Calling C_GetTokenInfo
0x00002450 : 0x00001060 : Input
0x00002450 : 0x00001060 : slotID: 1
0x00002450 : 0x00001060 : pInfo: 007BF608
0x00002450 : 0x00001060 : Output
0x00002450 : 0x00001060 : pInfo: 007BF608
0x00002450 : 0x00001060 : label:
0x00002450 : 0x00001060 : manufacturerID: SoftHSM project
0x00002450 : 0x00001060 : model: SoftHSM v2
0x00002450 : 0x00001060 : serialNumber:
0x00002450 : 0x00001060 : flags: 12582949
0x00002450 : 0x00001060 : CKF_RNG: TRUE
0x00002450 : 0x00001060 : CKF_WRITE_PROTECTED: FALSE
0x00002450 : 0x00001060 : CKF_LOGIN_REQUIRED: TRUE
0x00002450 : 0x00001060 : CKF_USER_PIN_INITIALIZED: FALSE
0x00002450 : 0x00001060 : CKF_RESTORE_KEY_NOT_NEEDED: TRUE
0x00002450 : 0x00001060 : CKF_CLOCK_ON_TOKEN: FALSE
0x00002450 : 0x00001060 : CKF_PROTECTED_AUTHENTICATION_PATH: FALSE
0x00002450 : 0x00001060 : CKF_DUAL_CRYPTO_OPERATIONS: FALSE
0x00002450 : 0x00001060 : CKF_TOKEN_INITIALIZED: FALSE
0x00002450 : 0x00001060 : CKF_SECONDARY_AUTHENTICATION: FALSE
0x00002450 : 0x00001060 : CKF_USER_PIN_COUNT_LOW: FALSE
0x00002450 : 0x00001060 : CKF_USER_PIN_FINAL_TRY: FALSE
0x00002450 : 0x00001060 : CKF_USER_PIN_LOCKED: FALSE
0x00002450 : 0x00001060 : CKF_USER_PIN_TO_BE_CHANGED: FALSE
0x00002450 : 0x00001060 : CKF_SO_PIN_COUNT_LOW: FALSE
0x00002450 : 0x00001060 : CKF_SO_PIN_FINAL_TRY: FALSE
0x00002450 : 0x00001060 : CKF_SO_PIN_LOCKED: TRUE
0x00002450 : 0x00001060 : CKF_SO_PIN_TO_BE_CHANGED: TRUE
0x00002450 : 0x00001060 : ulMaxSessionCount: 0
0x00002450 : 0x00001060 : ulSessionCount: 4294967295
0x00002450 : 0x00001060 : ulMaxRwSessionCount: 0
0x00002450 : 0x00001060 : ulRwSessionCount: 4294967295
0x00002450 : 0x00001060 : ulMaxPinLen: 255
0x00002450 : 0x00001060 : ulMinPinLen: 4
0x00002450 : 0x00001060 : ulTotalPublicMemory: 4294967295
0x00002450 : 0x00001060 : ulFreePublicMemory: 4294967295
0x00002450 : 0x00001060 : ulTotalPrivateMemory: 4294967295
0x00002450 : 0x00001060 : ulFreePrivateMemory: 4294967295
0x00002450 : 0x00001060 : hardwareVersion:
0x00002450 : 0x00001060 : major: 2
0x00002450 : 0x00001060 : minor: 2
0x00002450 : 0x00001060 : firmwareVersion:
0x00002450 : 0x00001060 : major: 2
0x00002450 : 0x00001060 : minor: 2
0x00002450 : 0x00001060 : utcTime: 2017063022061400
0x00002450 : 0x00001060 : Returning 0 (CKR_OK)
Manufacturer ID: SoftHSM project
Model: SoftHSM v2
Hardware version: 2.2
Firmware version: 2.2
Serial number:
Initialized: no
User PIN init.: no
Label:
0x00002450 : 0x00001060 : ****************************** 2017-07-01 00:06:14 ***
0x00002450 : 0x00001060 : Calling C_Finalize
0x00002450 : 0x00001060 : Input
0x00002450 : 0x00001060 : pReserved: 00000000
0x00002450 : 0x00001060 : Returning 0 (CKR_OK)
As you can see pkcs11-logger is working fine in my case and dumps all PKCS#11 calls stdout
. Could you please provide similar step-by-step guide showing how to replicate your problem?
@hinhmd is there any update on this? Was provided step-by-step guide helpful?
Closing because of 14+ days without a response.
Tested this with Adobe Reader and SafeNet eTPKCS11.dll, working LIKE A CHARM, thank you @jariq for this awesome tool!
Hi, I tried set some environment variables like this:
But the logger functions return CKR_GENERAL_ERROR. I am using VS 2015 and Windows 10. Thanks.