root@ca-user:/home/sanaullah# PKCS11SPY=/usr/lunasa/lib/libCryptoki2_64.so
root@ca-user:/home/sanaullah# export PKCS11SPY
Loading PKCS11 engine to openssl
OpenSSL> engine dynamic -pre SO_PATH:/usr/lib/ssl/engines/engine_pkcs11.so -pre ID:pkcs11 -pre LIST_ADD:1 -pre LOAD -pre MODULE_PATH:/usr/lib/pkcs11-spy.so
(dynamic) Dynamic engine loading support
Loaded: (pkcs11) pkcs11 engine
***************Creating a certificate request using the key label rsa2048_2 ***
OpenSSL> req -engine pkcs11 -new -key slot_1-label_rsa2048_2 -keyform engine -out cert.pem -text -x509 -days 3640 -subj "/CN=TestCA"
*************** OpenSC PKCS#11 spy *****************
Loaded: "/usr/lunasa/lib/libCryptoki2_64.so"
0: C_GetFunctionList
Returned: 0 CKR_OK
1: C_Initialize
[in] pInitArgs = 0x7fff31a8d0f0
Returned: 0 CKR_OK
2: C_GetInfo
[out] pInfo:
cryptokiVersion: 2.20
manufacturerID: ' SafeNet, Inc. '
flags: 0
libraryDescription: ' Chrystoki '
libraryVersion: 5.1
Returned: 0 CKR_OK
engine "pkcs11" set.
3: C_GetSlotList
[in] tokenPresent = 0x0
[out] pSlotList:
Count is 4
[out] *pulCount = 0x4
Returned: 0 CKR_OK
4: C_GetSlotList
[in] tokenPresent = 0x0
[out] pSlotList:
Slot 1
Slot 2
Slot 3
Slot 4
[out] *pulCount = 0x4
Returned: 0 CKR_OK
5: C_GetSlotInfo
[in] slotID = 0x1
[out] pInfo:
slotDescription: 'LunaNet Slot '
' '
manufacturerID: 'Unknown '
hardwareVersion: 0.0
firmwareVersion: 0.0
flags: 7
CKF_TOKEN_PRESENT
CKF_REMOVABLE_DEVICE
CKF_HW_SLOT
Returned: 0 CKR_OK
6: C_GetTokenInfo
[in] slotID = 0x1
[out] pInfo:
label: 'CAUser '
manufacturerID: 'Safenet, Inc. '
model: 'LunaSA '
serialNumber: '154839010 '
ulMaxSessionCount: 0
ulSessionCount: 1
ulMaxRwSessionCount: 0
ulRwSessionCount: 1
ulMaxPinLen: 255
ulMinPinLen: 7
ulTotalPublicMemory: 16776568
ulFreePublicMemory: 16690200
ulTotalPrivateMemory: 16776704
ulFreePrivateMemory: 16754744
hardwareVersion: 0.0
firmwareVersion: 6.21
time: ' '
flags: 42d
CKF_RNG
CKF_LOGIN_REQUIRED
CKF_USER_PIN_INITIALIZED
CKF_RESTORE_KEY_NOT_NEEDED
CKF_TOKEN_INITIALIZED
Returned: 0 CKR_OK
7: C_GetSlotInfo
[in] slotID = 0x2
[out] pInfo:
slotDescription: 'Luna UHD Slot '
' '
manufacturerID: 'Unknown '
hardwareVersion: 0.0
firmwareVersion: 0.0
flags: 6
CKF_REMOVABLE_DEVICE
CKF_HW_SLOT
Returned: 0 CKR_OK
8: C_GetSlotInfo
[in] slotID = 0x3
[out] pInfo:
slotDescription: 'Luna UHD Slot '
' '
manufacturerID: 'Unknown '
hardwareVersion: 0.0
firmwareVersion: 0.0
flags: 6
CKF_REMOVABLE_DEVICE
CKF_HW_SLOT
Returned: 0 CKR_OK
9: C_GetSlotInfo
[in] slotID = 0x4
[out] pInfo:
slotDescription: 'Luna UHD Slot '
' '
manufacturerID: 'Unknown '
hardwareVersion: 0.0
firmwareVersion: 0.0
flags: 6
CKF_REMOVABLE_DEVICE
CKF_HW_SLOT
Returned: 0 CKR_OK
10: C_OpenSession
[in] slotID = 0x1
[in] flags = 0x4
pApplication=(nil)
Notify=(nil)
[out] *phSession = 0x1
Returned: 0 CKR_OK
11: C_FindObjectsInit
[in] hSession = 0x1
[in] pTemplate[1]:
CKA_CLASS CKO_CERTIFICATE
Returned: 0 CKR_OK
12: C_FindObjects
[in] hSession = 0x1
[in] ulMaxObjectCount = 0x1
[out] ulObjectCount = 0x0
Returned: 0 CKR_OK
13: C_FindObjectsFinal
[in] hSession = 0x1
Returned: 0 CKR_OK
PKCS#11 token PIN:
14: C_Login
[in] hSession = 0x1
[in] userType = CKU_USER
[in] pPin[ulPinLen] 0000000000e90720 / 24
71753378 51743430 2F336655 6269446E 52713770 70496F30
Returned: 0 CKR_OK
15: C_FindObjectsInit
[in] hSession = 0x1
[in] pTemplate[1]:
CKA_CLASS CKO_PRIVATE_KEY
Returned: 0 CKR_OK
16: C_FindObjects
[in] hSession = 0x1
[in] ulMaxObjectCount = 0x1
[out] ulObjectCount = 0x1
Object 0x12 matches
Returned: 0 CKR_OK
17: C_GetAttributeValue
[in] hSession = 0x1
[in] hObject = 0x12
[in] pTemplate[1]:
CKA_KEY_TYPE 00007fff31a8cfa0 / 8
[out] pTemplate[1]:
CKA_KEY_TYPE CKK_RSA
Returned: 0 CKR_OK
18: C_GetAttributeValue
[in] hSession = 0x1
[in] hObject = 0x12
[in] pTemplate[1]:
CKA_LABEL 00007fff31a8cd50 / 256
Segmentation fault (core dumped)