Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CKR_DATA_INVALID when attempting to sign data using SignPath Cryptoki library #235

Open
NxSoftware opened this issue Apr 11, 2024 · 6 comments
Assignees
Labels

Comments

@NxSoftware
Copy link

I'm trying to use Pkcs11Interop with the SignPath Cryptoki provider to CMS sign some data but getting the CKR_DATA_INVALID error at the point of calling session.Sign.

I've include the code, exception, and logs from PKCS11-LOGGER, please can you advise?

Many thanks

Code

#region SENSITIVE
const string PIN = "REDACTED";
const string KEY_ID = "REDACTED";
#endregion

const string libraryPath = "/app/libSignPath.Cryptoki.so";
const string loggerPath = "/app/pkcs11-logger-x64.so";
const string logPath = "/app/pkcs11.log";

Environment.SetEnvironmentVariable("PKCS11_LOGGER_LIBRARY_PATH", libraryPath);
Environment.SetEnvironmentVariable("PKCS11_LOGGER_LOG_FILE_PATH", logPath);
Environment.SetEnvironmentVariable("PKCS11_LOGGER_FLAGS", "64");

var stringToSign = "Hello World";
var dataToSign = Encoding.UTF8.GetBytes(stringToSign);

var factories = new Pkcs11InteropFactories();

using var pkcs11Library = factories.Pkcs11LibraryFactory.LoadPkcs11Library(
    factories,
    loggerPath,
    AppType.MultiThreaded);

var libraryInfo = pkcs11Library.GetInfo();
var slots = pkcs11Library.GetSlotList(SlotsType.WithTokenPresent);
var slot = slots.FirstOrDefault();

if (slot is null)
{
    throw new InvalidOperationException("No slots available");
}

using var session = slot.OpenSession(SessionType.ReadOnly);
session.Login(CKU.CKU_USER, PIN);

// Prepare attribute template that defines search criteria
List<IObjectAttribute> privateKeyAttributes = new()
{
    session.Factories.ObjectAttributeFactory.Create(CKA.CKA_CLASS, CKO.CKO_PRIVATE_KEY),
    session.Factories.ObjectAttributeFactory.Create(CKA.CKA_KEY_TYPE, CKK.CKK_RSA),
    session.Factories.ObjectAttributeFactory.Create(CKA.CKA_ID, KEY_ID),
};

List<IObjectHandle> foundPrivateKeys = session.FindAllObjects(privateKeyAttributes);
var privateKeyHandle = foundPrivateKeys[0];

var mechanism = session.Factories.MechanismFactory.Create(CKM.CKM_RSA_PKCS);
var signature = session.Sign(mechanism, privateKeyHandle, dataToSign);

Console.WriteLine("Done");

Exception

An unhandled exception of type 'Net.Pkcs11Interop.Common.Pkcs11Exception' occurred in Pkcs11Interop.dll: 'Method C_Sign returned CKR_DATA_INVALID'
   at Net.Pkcs11Interop.HighLevelAPI80.Session.Sign(IMechanism mechanism, IObjectHandle keyHandle, Byte[] data, Boolean performLogin, Byte[] keyPin)
   at Net.Pkcs11Interop.HighLevelAPI80.Session.Sign(IMechanism mechanism, IObjectHandle keyHandle, Byte[] data)
   at Program.<Main>$(String[] args) in C:\Users\steve\Development\Pk11\Program.cs:line 52

Logs from PKCS11-LOGGER

Expand me
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:04 ***
0x0000001a : 0x80b69740 : PKCS11-LOGGER 2.2.0
0x0000001a : 0x80b69740 : PKCS#11 logging proxy module
0x0000001a : 0x80b69740 : Developed as a part of the Pkcs11Interop project
0x0000001a : 0x80b69740 : Please visit www.pkcs11interop.net for more information
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:04 ***
0x0000001a : 0x80b69740 : Successfuly loaded /app/libSignPath.Cryptoki.so
0x0000001a : 0x80b69740 : Memory contents are dumped without endianness conversion
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:04 ***
0x0000001a : 0x80b69740 : Calling C_GetFunctionList
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  ppFunctionList: 0x7ffea27bc758
0x0000001a : 0x80b69740 : Output
0x0000001a : 0x80b69740 :  Note: Returning function list of PKCS11-LOGGER
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:04 ***
0x0000001a : 0x80b69740 : Calling C_Initialize
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  pInitArgs: 0x7f26ee80e0c0
0x0000001a : 0x80b69740 :   CreateMutex: (nil)
0x0000001a : 0x80b69740 :   DestroyMutex: (nil)
0x0000001a : 0x80b69740 :   LockMutex: (nil)
0x0000001a : 0x80b69740 :   UnlockMutex: (nil)
0x0000001a : 0x80b69740 :   Flags: 2
0x0000001a : 0x80b69740 :    CKF_LIBRARY_CANT_CREATE_OS_THREADS: FALSE
0x0000001a : 0x80b69740 :    CKF_OS_LOCKING_OK: TRUE
0x0000001a : 0x80b69740 :   pReserved: (nil)
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:04 ***
0x0000001a : 0x80b69740 : Calling C_GetInfo
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  pInfo: 0x7ffea27bc700
0x0000001a : 0x80b69740 : Output
0x0000001a : 0x80b69740 :  pInfo: 0x7ffea27bc700
0x0000001a : 0x80b69740 :   cryptokiVersion:
0x0000001a : 0x80b69740 :    major: 2
0x0000001a : 0x80b69740 :    minor: 40
0x0000001a : 0x80b69740 :   manufacturerID: SignPath                        
0x0000001a : 0x80b69740 :   flags: 0
0x0000001a : 0x80b69740 :   libraryDescription: SignPath PKCS#11 Provider v4.3  
0x0000001a : 0x80b69740 :   libraryVersion:
0x0000001a : 0x80b69740 :    major: 4
0x0000001a : 0x80b69740 :    minor: 3
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:04 ***
0x0000001a : 0x80b69740 : Calling C_GetSlotList
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  tokenPresent: 1
0x0000001a : 0x80b69740 :  pSlotList: (nil)
0x0000001a : 0x80b69740 :  pulCount: 0x7ffea27bc890
0x0000001a : 0x80b69740 :  *pulCount: 0
0x0000001a : 0x80b69740 : Output
0x0000001a : 0x80b69740 :  pSlotList: (nil)
0x0000001a : 0x80b69740 :  pulCount: 0x7ffea27bc890
0x0000001a : 0x80b69740 :  *pulCount: 1
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:04 ***
0x0000001a : 0x80b69740 : Calling C_GetSlotList
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  tokenPresent: 1
0x0000001a : 0x80b69740 :  pSlotList: 0x7f26ee80e580
0x0000001a : 0x80b69740 :  pulCount: 0x7ffea27bc890
0x0000001a : 0x80b69740 :  *pulCount: 1
0x0000001a : 0x80b69740 : Output
0x0000001a : 0x80b69740 :  pSlotList: 0x7f26ee80e580
0x0000001a : 0x80b69740 :  pSlotList[0]: 1
0x0000001a : 0x80b69740 :  pulCount: 0x7ffea27bc890
0x0000001a : 0x80b69740 :  *pulCount: 1
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:04 ***
0x0000001a : 0x80b69740 : Calling C_OpenSession
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  slotID: 1
0x0000001a : 0x80b69740 :  flags: 4
0x0000001a : 0x80b69740 :   CKF_RW_SESSION: FALSE
0x0000001a : 0x80b69740 :   CKF_SERIAL_SESSION: TRUE
0x0000001a : 0x80b69740 :  pApplication: (nil)
0x0000001a : 0x80b69740 :  Notify: (nil)
0x0000001a : 0x80b69740 :  phSession: 0x7ffea27bc8b0
0x0000001a : 0x80b69740 :  *phSession: 140731624442032
0x0000001a : 0x80b69740 : Output
0x0000001a : 0x80b69740 :  phSession: 0x7ffea27bc8b0
0x0000001a : 0x80b69740 :  *phSession: 1
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:04 ***
0x0000001a : 0x80b69740 : Calling C_Login
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  hSession: 1
0x0000001a : 0x80b69740 :  userType: 1 (CKU_USER)
0x0000001a : 0x80b69740 :  pPin: 0x7f26ee80e9e8
0x0000001a : 0x80b69740 :  *pPin: *** Intentionally hidden ***
0x0000001a : 0x80b69740 :  ulPinLen: 81
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:06 ***
0x0000001a : 0x80b69740 : Calling C_FindObjectsInit
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  hSession: 1
0x0000001a : 0x80b69740 :  pTemplate: 0x5590b440a5b0
0x0000001a : 0x80b69740 :  ulCount: 3
0x0000001a : 0x80b69740 :   *** Begin attribute template ***
0x0000001a : 0x80b69740 :   Attribute 0
0x0000001a : 0x80b69740 :    Attribute: 0 (CKA_CLASS)
0x0000001a : 0x80b69740 :    pValue: 0x5590b4402490
0x0000001a : 0x80b69740 :    ulValueLen: 8
0x0000001a : 0x80b69740 :    *pValue: HEX(0300000000000000)
0x0000001a : 0x80b69740 :   Attribute 1
0x0000001a : 0x80b69740 :    Attribute: 256 (CKA_KEY_TYPE)
0x0000001a : 0x80b69740 :    pValue: 0x5590b440a600
0x0000001a : 0x80b69740 :    ulValueLen: 8
0x0000001a : 0x80b69740 :    *pValue: HEX(0000000000000000)
0x0000001a : 0x80b69740 :   Attribute 2
0x0000001a : 0x80b69740 :    Attribute: 258 (CKA_ID)
0x0000001a : 0x80b69740 :    pValue: 0x5590b44084a0
0x0000001a : 0x80b69740 :    ulValueLen: 17
0x0000001a : 0x80b69740 :    *pValue: HEX(6E6F727468737461722F646D612D726D6D)
0x0000001a : 0x80b69740 :   *** End attribute template ***
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:06 ***
0x0000001a : 0x80b69740 : Calling C_FindObjects
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  hSession: 1
0x0000001a : 0x80b69740 :  phObject: 0x7f26ee80f120
0x0000001a : 0x80b69740 :  ulMaxObjectCount: 256
0x0000001a : 0x80b69740 :  pulObjectCount: 0x7ffea27bc860
0x0000001a : 0x80b69740 :  *pulObjectCount: 256
0x0000001a : 0x80b69740 :   *phObject[0]: 0
0x0000001a : 0x80b69740 :   *phObject[1]: 0
0x0000001a : 0x80b69740 :   *phObject[2]: 0
0x0000001a : 0x80b69740 :   *phObject[3]: 0
0x0000001a : 0x80b69740 :   *phObject[4]: 0
0x0000001a : 0x80b69740 :   *phObject[5]: 0
0x0000001a : 0x80b69740 :   *phObject[6]: 0
0x0000001a : 0x80b69740 :   *phObject[7]: 0
0x0000001a : 0x80b69740 :   *phObject[8]: 0
0x0000001a : 0x80b69740 :   *phObject[9]: 0
0x0000001a : 0x80b69740 :   *phObject[10]: 0
0x0000001a : 0x80b69740 :   *phObject[11]: 0
0x0000001a : 0x80b69740 :   *phObject[12]: 0
0x0000001a : 0x80b69740 :   *phObject[13]: 0
0x0000001a : 0x80b69740 :   *phObject[14]: 0
0x0000001a : 0x80b69740 :   *phObject[15]: 0
0x0000001a : 0x80b69740 :   *phObject[16]: 0
0x0000001a : 0x80b69740 :   *phObject[17]: 0
0x0000001a : 0x80b69740 :   *phObject[18]: 0
0x0000001a : 0x80b69740 :   *phObject[19]: 0
0x0000001a : 0x80b69740 :   *phObject[20]: 0
0x0000001a : 0x80b69740 :   *phObject[21]: 0
0x0000001a : 0x80b69740 :   *phObject[22]: 0
0x0000001a : 0x80b69740 :   *phObject[23]: 0
0x0000001a : 0x80b69740 :   *phObject[24]: 0
0x0000001a : 0x80b69740 :   *phObject[25]: 0
0x0000001a : 0x80b69740 :   *phObject[26]: 0
0x0000001a : 0x80b69740 :   *phObject[27]: 0
0x0000001a : 0x80b69740 :   *phObject[28]: 0
0x0000001a : 0x80b69740 :   *phObject[29]: 0
0x0000001a : 0x80b69740 :   *phObject[30]: 0
0x0000001a : 0x80b69740 :   *phObject[31]: 0
0x0000001a : 0x80b69740 :   *phObject[32]: 0
0x0000001a : 0x80b69740 :   *phObject[33]: 0
0x0000001a : 0x80b69740 :   *phObject[34]: 0
0x0000001a : 0x80b69740 :   *phObject[35]: 0
0x0000001a : 0x80b69740 :   *phObject[36]: 0
0x0000001a : 0x80b69740 :   *phObject[37]: 0
0x0000001a : 0x80b69740 :   *phObject[38]: 0
0x0000001a : 0x80b69740 :   *phObject[39]: 0
0x0000001a : 0x80b69740 :   *phObject[40]: 0
0x0000001a : 0x80b69740 :   *phObject[41]: 0
0x0000001a : 0x80b69740 :   *phObject[42]: 0
0x0000001a : 0x80b69740 :   *phObject[43]: 0
0x0000001a : 0x80b69740 :   *phObject[44]: 0
0x0000001a : 0x80b69740 :   *phObject[45]: 0
0x0000001a : 0x80b69740 :   *phObject[46]: 0
0x0000001a : 0x80b69740 :   *phObject[47]: 0
0x0000001a : 0x80b69740 :   *phObject[48]: 0
0x0000001a : 0x80b69740 :   *phObject[49]: 0
0x0000001a : 0x80b69740 :   *phObject[50]: 0
0x0000001a : 0x80b69740 :   *phObject[51]: 0
0x0000001a : 0x80b69740 :   *phObject[52]: 0
0x0000001a : 0x80b69740 :   *phObject[53]: 0
0x0000001a : 0x80b69740 :   *phObject[54]: 0
0x0000001a : 0x80b69740 :   *phObject[55]: 0
0x0000001a : 0x80b69740 :   *phObject[56]: 0
0x0000001a : 0x80b69740 :   *phObject[57]: 0
0x0000001a : 0x80b69740 :   *phObject[58]: 0
0x0000001a : 0x80b69740 :   *phObject[59]: 0
0x0000001a : 0x80b69740 :   *phObject[60]: 0
0x0000001a : 0x80b69740 :   *phObject[61]: 0
0x0000001a : 0x80b69740 :   *phObject[62]: 0
0x0000001a : 0x80b69740 :   *phObject[63]: 0
0x0000001a : 0x80b69740 :   *phObject[64]: 0
0x0000001a : 0x80b69740 :   *phObject[65]: 0
0x0000001a : 0x80b69740 :   *phObject[66]: 0
0x0000001a : 0x80b69740 :   *phObject[67]: 0
0x0000001a : 0x80b69740 :   *phObject[68]: 0
0x0000001a : 0x80b69740 :   *phObject[69]: 0
0x0000001a : 0x80b69740 :   *phObject[70]: 0
0x0000001a : 0x80b69740 :   *phObject[71]: 0
0x0000001a : 0x80b69740 :   *phObject[72]: 0
0x0000001a : 0x80b69740 :   *phObject[73]: 0
0x0000001a : 0x80b69740 :   *phObject[74]: 0
0x0000001a : 0x80b69740 :   *phObject[75]: 0
0x0000001a : 0x80b69740 :   *phObject[76]: 0
0x0000001a : 0x80b69740 :   *phObject[77]: 0
0x0000001a : 0x80b69740 :   *phObject[78]: 0
0x0000001a : 0x80b69740 :   *phObject[79]: 0
0x0000001a : 0x80b69740 :   *phObject[80]: 0
0x0000001a : 0x80b69740 :   *phObject[81]: 0
0x0000001a : 0x80b69740 :   *phObject[82]: 0
0x0000001a : 0x80b69740 :   *phObject[83]: 0
0x0000001a : 0x80b69740 :   *phObject[84]: 0
0x0000001a : 0x80b69740 :   *phObject[85]: 0
0x0000001a : 0x80b69740 :   *phObject[86]: 0
0x0000001a : 0x80b69740 :   *phObject[87]: 0
0x0000001a : 0x80b69740 :   *phObject[88]: 0
0x0000001a : 0x80b69740 :   *phObject[89]: 0
0x0000001a : 0x80b69740 :   *phObject[90]: 0
0x0000001a : 0x80b69740 :   *phObject[91]: 0
0x0000001a : 0x80b69740 :   *phObject[92]: 0
0x0000001a : 0x80b69740 :   *phObject[93]: 0
0x0000001a : 0x80b69740 :   *phObject[94]: 0
0x0000001a : 0x80b69740 :   *phObject[95]: 0
0x0000001a : 0x80b69740 :   *phObject[96]: 0
0x0000001a : 0x80b69740 :   *phObject[97]: 0
0x0000001a : 0x80b69740 :   *phObject[98]: 0
0x0000001a : 0x80b69740 :   *phObject[99]: 0
0x0000001a : 0x80b69740 :   *phObject[100]: 0
0x0000001a : 0x80b69740 :   *phObject[101]: 0
0x0000001a : 0x80b69740 :   *phObject[102]: 0
0x0000001a : 0x80b69740 :   *phObject[103]: 0
0x0000001a : 0x80b69740 :   *phObject[104]: 0
0x0000001a : 0x80b69740 :   *phObject[105]: 0
0x0000001a : 0x80b69740 :   *phObject[106]: 0
0x0000001a : 0x80b69740 :   *phObject[107]: 0
0x0000001a : 0x80b69740 :   *phObject[108]: 0
0x0000001a : 0x80b69740 :   *phObject[109]: 0
0x0000001a : 0x80b69740 :   *phObject[110]: 0
0x0000001a : 0x80b69740 :   *phObject[111]: 0
0x0000001a : 0x80b69740 :   *phObject[112]: 0
0x0000001a : 0x80b69740 :   *phObject[113]: 0
0x0000001a : 0x80b69740 :   *phObject[114]: 0
0x0000001a : 0x80b69740 :   *phObject[115]: 0
0x0000001a : 0x80b69740 :   *phObject[116]: 0
0x0000001a : 0x80b69740 :   *phObject[117]: 0
0x0000001a : 0x80b69740 :   *phObject[118]: 0
0x0000001a : 0x80b69740 :   *phObject[119]: 0
0x0000001a : 0x80b69740 :   *phObject[120]: 0
0x0000001a : 0x80b69740 :   *phObject[121]: 0
0x0000001a : 0x80b69740 :   *phObject[122]: 0
0x0000001a : 0x80b69740 :   *phObject[123]: 0
0x0000001a : 0x80b69740 :   *phObject[124]: 0
0x0000001a : 0x80b69740 :   *phObject[125]: 0
0x0000001a : 0x80b69740 :   *phObject[126]: 0
0x0000001a : 0x80b69740 :   *phObject[127]: 0
0x0000001a : 0x80b69740 :   *phObject[128]: 0
0x0000001a : 0x80b69740 :   *phObject[129]: 0
0x0000001a : 0x80b69740 :   *phObject[130]: 0
0x0000001a : 0x80b69740 :   *phObject[131]: 0
0x0000001a : 0x80b69740 :   *phObject[132]: 0
0x0000001a : 0x80b69740 :   *phObject[133]: 0
0x0000001a : 0x80b69740 :   *phObject[134]: 0
0x0000001a : 0x80b69740 :   *phObject[135]: 0
0x0000001a : 0x80b69740 :   *phObject[136]: 0
0x0000001a : 0x80b69740 :   *phObject[137]: 0
0x0000001a : 0x80b69740 :   *phObject[138]: 0
0x0000001a : 0x80b69740 :   *phObject[139]: 0
0x0000001a : 0x80b69740 :   *phObject[140]: 0
0x0000001a : 0x80b69740 :   *phObject[141]: 0
0x0000001a : 0x80b69740 :   *phObject[142]: 0
0x0000001a : 0x80b69740 :   *phObject[143]: 0
0x0000001a : 0x80b69740 :   *phObject[144]: 0
0x0000001a : 0x80b69740 :   *phObject[145]: 0
0x0000001a : 0x80b69740 :   *phObject[146]: 0
0x0000001a : 0x80b69740 :   *phObject[147]: 0
0x0000001a : 0x80b69740 :   *phObject[148]: 0
0x0000001a : 0x80b69740 :   *phObject[149]: 0
0x0000001a : 0x80b69740 :   *phObject[150]: 0
0x0000001a : 0x80b69740 :   *phObject[151]: 0
0x0000001a : 0x80b69740 :   *phObject[152]: 0
0x0000001a : 0x80b69740 :   *phObject[153]: 0
0x0000001a : 0x80b69740 :   *phObject[154]: 0
0x0000001a : 0x80b69740 :   *phObject[155]: 0
0x0000001a : 0x80b69740 :   *phObject[156]: 0
0x0000001a : 0x80b69740 :   *phObject[157]: 0
0x0000001a : 0x80b69740 :   *phObject[158]: 0
0x0000001a : 0x80b69740 :   *phObject[159]: 0
0x0000001a : 0x80b69740 :   *phObject[160]: 0
0x0000001a : 0x80b69740 :   *phObject[161]: 0
0x0000001a : 0x80b69740 :   *phObject[162]: 0
0x0000001a : 0x80b69740 :   *phObject[163]: 0
0x0000001a : 0x80b69740 :   *phObject[164]: 0
0x0000001a : 0x80b69740 :   *phObject[165]: 0
0x0000001a : 0x80b69740 :   *phObject[166]: 0
0x0000001a : 0x80b69740 :   *phObject[167]: 0
0x0000001a : 0x80b69740 :   *phObject[168]: 0
0x0000001a : 0x80b69740 :   *phObject[169]: 0
0x0000001a : 0x80b69740 :   *phObject[170]: 0
0x0000001a : 0x80b69740 :   *phObject[171]: 0
0x0000001a : 0x80b69740 :   *phObject[172]: 0
0x0000001a : 0x80b69740 :   *phObject[173]: 0
0x0000001a : 0x80b69740 :   *phObject[174]: 0
0x0000001a : 0x80b69740 :   *phObject[175]: 0
0x0000001a : 0x80b69740 :   *phObject[176]: 0
0x0000001a : 0x80b69740 :   *phObject[177]: 0
0x0000001a : 0x80b69740 :   *phObject[178]: 0
0x0000001a : 0x80b69740 :   *phObject[179]: 0
0x0000001a : 0x80b69740 :   *phObject[180]: 0
0x0000001a : 0x80b69740 :   *phObject[181]: 0
0x0000001a : 0x80b69740 :   *phObject[182]: 0
0x0000001a : 0x80b69740 :   *phObject[183]: 0
0x0000001a : 0x80b69740 :   *phObject[184]: 0
0x0000001a : 0x80b69740 :   *phObject[185]: 0
0x0000001a : 0x80b69740 :   *phObject[186]: 0
0x0000001a : 0x80b69740 :   *phObject[187]: 0
0x0000001a : 0x80b69740 :   *phObject[188]: 0
0x0000001a : 0x80b69740 :   *phObject[189]: 0
0x0000001a : 0x80b69740 :   *phObject[190]: 0
0x0000001a : 0x80b69740 :   *phObject[191]: 0
0x0000001a : 0x80b69740 :   *phObject[192]: 0
0x0000001a : 0x80b69740 :   *phObject[193]: 0
0x0000001a : 0x80b69740 :   *phObject[194]: 0
0x0000001a : 0x80b69740 :   *phObject[195]: 0
0x0000001a : 0x80b69740 :   *phObject[196]: 0
0x0000001a : 0x80b69740 :   *phObject[197]: 0
0x0000001a : 0x80b69740 :   *phObject[198]: 0
0x0000001a : 0x80b69740 :   *phObject[199]: 0
0x0000001a : 0x80b69740 :   *phObject[200]: 0
0x0000001a : 0x80b69740 :   *phObject[201]: 0
0x0000001a : 0x80b69740 :   *phObject[202]: 0
0x0000001a : 0x80b69740 :   *phObject[203]: 0
0x0000001a : 0x80b69740 :   *phObject[204]: 0
0x0000001a : 0x80b69740 :   *phObject[205]: 0
0x0000001a : 0x80b69740 :   *phObject[206]: 0
0x0000001a : 0x80b69740 :   *phObject[207]: 0
0x0000001a : 0x80b69740 :   *phObject[208]: 0
0x0000001a : 0x80b69740 :   *phObject[209]: 0
0x0000001a : 0x80b69740 :   *phObject[210]: 0
0x0000001a : 0x80b69740 :   *phObject[211]: 0
0x0000001a : 0x80b69740 :   *phObject[212]: 0
0x0000001a : 0x80b69740 :   *phObject[213]: 0
0x0000001a : 0x80b69740 :   *phObject[214]: 0
0x0000001a : 0x80b69740 :   *phObject[215]: 0
0x0000001a : 0x80b69740 :   *phObject[216]: 0
0x0000001a : 0x80b69740 :   *phObject[217]: 0
0x0000001a : 0x80b69740 :   *phObject[218]: 0
0x0000001a : 0x80b69740 :   *phObject[219]: 0
0x0000001a : 0x80b69740 :   *phObject[220]: 0
0x0000001a : 0x80b69740 :   *phObject[221]: 0
0x0000001a : 0x80b69740 :   *phObject[222]: 0
0x0000001a : 0x80b69740 :   *phObject[223]: 0
0x0000001a : 0x80b69740 :   *phObject[224]: 0
0x0000001a : 0x80b69740 :   *phObject[225]: 0
0x0000001a : 0x80b69740 :   *phObject[226]: 0
0x0000001a : 0x80b69740 :   *phObject[227]: 0
0x0000001a : 0x80b69740 :   *phObject[228]: 0
0x0000001a : 0x80b69740 :   *phObject[229]: 0
0x0000001a : 0x80b69740 :   *phObject[230]: 0
0x0000001a : 0x80b69740 :   *phObject[231]: 0
0x0000001a : 0x80b69740 :   *phObject[232]: 0
0x0000001a : 0x80b69740 :   *phObject[233]: 0
0x0000001a : 0x80b69740 :   *phObject[234]: 0
0x0000001a : 0x80b69740 :   *phObject[235]: 0
0x0000001a : 0x80b69740 :   *phObject[236]: 0
0x0000001a : 0x80b69740 :   *phObject[237]: 0
0x0000001a : 0x80b69740 :   *phObject[238]: 0
0x0000001a : 0x80b69740 :   *phObject[239]: 0
0x0000001a : 0x80b69740 :   *phObject[240]: 0
0x0000001a : 0x80b69740 :   *phObject[241]: 0
0x0000001a : 0x80b69740 :   *phObject[242]: 0
0x0000001a : 0x80b69740 :   *phObject[243]: 0
0x0000001a : 0x80b69740 :   *phObject[244]: 0
0x0000001a : 0x80b69740 :   *phObject[245]: 0
0x0000001a : 0x80b69740 :   *phObject[246]: 0
0x0000001a : 0x80b69740 :   *phObject[247]: 0
0x0000001a : 0x80b69740 :   *phObject[248]: 0
0x0000001a : 0x80b69740 :   *phObject[249]: 0
0x0000001a : 0x80b69740 :   *phObject[250]: 0
0x0000001a : 0x80b69740 :   *phObject[251]: 0
0x0000001a : 0x80b69740 :   *phObject[252]: 0
0x0000001a : 0x80b69740 :   *phObject[253]: 0
0x0000001a : 0x80b69740 :   *phObject[254]: 0
0x0000001a : 0x80b69740 :   *phObject[255]: 0
0x0000001a : 0x80b69740 : Output
0x0000001a : 0x80b69740 :  phObject: 0x7f26ee80f120
0x0000001a : 0x80b69740 :  ulMaxObjectCount: 256
0x0000001a : 0x80b69740 :  pulObjectCount: 0x7ffea27bc860
0x0000001a : 0x80b69740 :  *pulObjectCount: 1
0x0000001a : 0x80b69740 :   *phObject[0]: 12
0x0000001a : 0x80b69740 :   *phObject[1]: 0
0x0000001a : 0x80b69740 :   *phObject[2]: 0
0x0000001a : 0x80b69740 :   *phObject[3]: 0
0x0000001a : 0x80b69740 :   *phObject[4]: 0
0x0000001a : 0x80b69740 :   *phObject[5]: 0
0x0000001a : 0x80b69740 :   *phObject[6]: 0
0x0000001a : 0x80b69740 :   *phObject[7]: 0
0x0000001a : 0x80b69740 :   *phObject[8]: 0
0x0000001a : 0x80b69740 :   *phObject[9]: 0
0x0000001a : 0x80b69740 :   *phObject[10]: 0
0x0000001a : 0x80b69740 :   *phObject[11]: 0
0x0000001a : 0x80b69740 :   *phObject[12]: 0
0x0000001a : 0x80b69740 :   *phObject[13]: 0
0x0000001a : 0x80b69740 :   *phObject[14]: 0
0x0000001a : 0x80b69740 :   *phObject[15]: 0
0x0000001a : 0x80b69740 :   *phObject[16]: 0
0x0000001a : 0x80b69740 :   *phObject[17]: 0
0x0000001a : 0x80b69740 :   *phObject[18]: 0
0x0000001a : 0x80b69740 :   *phObject[19]: 0
0x0000001a : 0x80b69740 :   *phObject[20]: 0
0x0000001a : 0x80b69740 :   *phObject[21]: 0
0x0000001a : 0x80b69740 :   *phObject[22]: 0
0x0000001a : 0x80b69740 :   *phObject[23]: 0
0x0000001a : 0x80b69740 :   *phObject[24]: 0
0x0000001a : 0x80b69740 :   *phObject[25]: 0
0x0000001a : 0x80b69740 :   *phObject[26]: 0
0x0000001a : 0x80b69740 :   *phObject[27]: 0
0x0000001a : 0x80b69740 :   *phObject[28]: 0
0x0000001a : 0x80b69740 :   *phObject[29]: 0
0x0000001a : 0x80b69740 :   *phObject[30]: 0
0x0000001a : 0x80b69740 :   *phObject[31]: 0
0x0000001a : 0x80b69740 :   *phObject[32]: 0
0x0000001a : 0x80b69740 :   *phObject[33]: 0
0x0000001a : 0x80b69740 :   *phObject[34]: 0
0x0000001a : 0x80b69740 :   *phObject[35]: 0
0x0000001a : 0x80b69740 :   *phObject[36]: 0
0x0000001a : 0x80b69740 :   *phObject[37]: 0
0x0000001a : 0x80b69740 :   *phObject[38]: 0
0x0000001a : 0x80b69740 :   *phObject[39]: 0
0x0000001a : 0x80b69740 :   *phObject[40]: 0
0x0000001a : 0x80b69740 :   *phObject[41]: 0
0x0000001a : 0x80b69740 :   *phObject[42]: 0
0x0000001a : 0x80b69740 :   *phObject[43]: 0
0x0000001a : 0x80b69740 :   *phObject[44]: 0
0x0000001a : 0x80b69740 :   *phObject[45]: 0
0x0000001a : 0x80b69740 :   *phObject[46]: 0
0x0000001a : 0x80b69740 :   *phObject[47]: 0
0x0000001a : 0x80b69740 :   *phObject[48]: 0
0x0000001a : 0x80b69740 :   *phObject[49]: 0
0x0000001a : 0x80b69740 :   *phObject[50]: 0
0x0000001a : 0x80b69740 :   *phObject[51]: 0
0x0000001a : 0x80b69740 :   *phObject[52]: 0
0x0000001a : 0x80b69740 :   *phObject[53]: 0
0x0000001a : 0x80b69740 :   *phObject[54]: 0
0x0000001a : 0x80b69740 :   *phObject[55]: 0
0x0000001a : 0x80b69740 :   *phObject[56]: 0
0x0000001a : 0x80b69740 :   *phObject[57]: 0
0x0000001a : 0x80b69740 :   *phObject[58]: 0
0x0000001a : 0x80b69740 :   *phObject[59]: 0
0x0000001a : 0x80b69740 :   *phObject[60]: 0
0x0000001a : 0x80b69740 :   *phObject[61]: 0
0x0000001a : 0x80b69740 :   *phObject[62]: 0
0x0000001a : 0x80b69740 :   *phObject[63]: 0
0x0000001a : 0x80b69740 :   *phObject[64]: 0
0x0000001a : 0x80b69740 :   *phObject[65]: 0
0x0000001a : 0x80b69740 :   *phObject[66]: 0
0x0000001a : 0x80b69740 :   *phObject[67]: 0
0x0000001a : 0x80b69740 :   *phObject[68]: 0
0x0000001a : 0x80b69740 :   *phObject[69]: 0
0x0000001a : 0x80b69740 :   *phObject[70]: 0
0x0000001a : 0x80b69740 :   *phObject[71]: 0
0x0000001a : 0x80b69740 :   *phObject[72]: 0
0x0000001a : 0x80b69740 :   *phObject[73]: 0
0x0000001a : 0x80b69740 :   *phObject[74]: 0
0x0000001a : 0x80b69740 :   *phObject[75]: 0
0x0000001a : 0x80b69740 :   *phObject[76]: 0
0x0000001a : 0x80b69740 :   *phObject[77]: 0
0x0000001a : 0x80b69740 :   *phObject[78]: 0
0x0000001a : 0x80b69740 :   *phObject[79]: 0
0x0000001a : 0x80b69740 :   *phObject[80]: 0
0x0000001a : 0x80b69740 :   *phObject[81]: 0
0x0000001a : 0x80b69740 :   *phObject[82]: 0
0x0000001a : 0x80b69740 :   *phObject[83]: 0
0x0000001a : 0x80b69740 :   *phObject[84]: 0
0x0000001a : 0x80b69740 :   *phObject[85]: 0
0x0000001a : 0x80b69740 :   *phObject[86]: 0
0x0000001a : 0x80b69740 :   *phObject[87]: 0
0x0000001a : 0x80b69740 :   *phObject[88]: 0
0x0000001a : 0x80b69740 :   *phObject[89]: 0
0x0000001a : 0x80b69740 :   *phObject[90]: 0
0x0000001a : 0x80b69740 :   *phObject[91]: 0
0x0000001a : 0x80b69740 :   *phObject[92]: 0
0x0000001a : 0x80b69740 :   *phObject[93]: 0
0x0000001a : 0x80b69740 :   *phObject[94]: 0
0x0000001a : 0x80b69740 :   *phObject[95]: 0
0x0000001a : 0x80b69740 :   *phObject[96]: 0
0x0000001a : 0x80b69740 :   *phObject[97]: 0
0x0000001a : 0x80b69740 :   *phObject[98]: 0
0x0000001a : 0x80b69740 :   *phObject[99]: 0
0x0000001a : 0x80b69740 :   *phObject[100]: 0
0x0000001a : 0x80b69740 :   *phObject[101]: 0
0x0000001a : 0x80b69740 :   *phObject[102]: 0
0x0000001a : 0x80b69740 :   *phObject[103]: 0
0x0000001a : 0x80b69740 :   *phObject[104]: 0
0x0000001a : 0x80b69740 :   *phObject[105]: 0
0x0000001a : 0x80b69740 :   *phObject[106]: 0
0x0000001a : 0x80b69740 :   *phObject[107]: 0
0x0000001a : 0x80b69740 :   *phObject[108]: 0
0x0000001a : 0x80b69740 :   *phObject[109]: 0
0x0000001a : 0x80b69740 :   *phObject[110]: 0
0x0000001a : 0x80b69740 :   *phObject[111]: 0
0x0000001a : 0x80b69740 :   *phObject[112]: 0
0x0000001a : 0x80b69740 :   *phObject[113]: 0
0x0000001a : 0x80b69740 :   *phObject[114]: 0
0x0000001a : 0x80b69740 :   *phObject[115]: 0
0x0000001a : 0x80b69740 :   *phObject[116]: 0
0x0000001a : 0x80b69740 :   *phObject[117]: 0
0x0000001a : 0x80b69740 :   *phObject[118]: 0
0x0000001a : 0x80b69740 :   *phObject[119]: 0
0x0000001a : 0x80b69740 :   *phObject[120]: 0
0x0000001a : 0x80b69740 :   *phObject[121]: 0
0x0000001a : 0x80b69740 :   *phObject[122]: 0
0x0000001a : 0x80b69740 :   *phObject[123]: 0
0x0000001a : 0x80b69740 :   *phObject[124]: 0
0x0000001a : 0x80b69740 :   *phObject[125]: 0
0x0000001a : 0x80b69740 :   *phObject[126]: 0
0x0000001a : 0x80b69740 :   *phObject[127]: 0
0x0000001a : 0x80b69740 :   *phObject[128]: 0
0x0000001a : 0x80b69740 :   *phObject[129]: 0
0x0000001a : 0x80b69740 :   *phObject[130]: 0
0x0000001a : 0x80b69740 :   *phObject[131]: 0
0x0000001a : 0x80b69740 :   *phObject[132]: 0
0x0000001a : 0x80b69740 :   *phObject[133]: 0
0x0000001a : 0x80b69740 :   *phObject[134]: 0
0x0000001a : 0x80b69740 :   *phObject[135]: 0
0x0000001a : 0x80b69740 :   *phObject[136]: 0
0x0000001a : 0x80b69740 :   *phObject[137]: 0
0x0000001a : 0x80b69740 :   *phObject[138]: 0
0x0000001a : 0x80b69740 :   *phObject[139]: 0
0x0000001a : 0x80b69740 :   *phObject[140]: 0
0x0000001a : 0x80b69740 :   *phObject[141]: 0
0x0000001a : 0x80b69740 :   *phObject[142]: 0
0x0000001a : 0x80b69740 :   *phObject[143]: 0
0x0000001a : 0x80b69740 :   *phObject[144]: 0
0x0000001a : 0x80b69740 :   *phObject[145]: 0
0x0000001a : 0x80b69740 :   *phObject[146]: 0
0x0000001a : 0x80b69740 :   *phObject[147]: 0
0x0000001a : 0x80b69740 :   *phObject[148]: 0
0x0000001a : 0x80b69740 :   *phObject[149]: 0
0x0000001a : 0x80b69740 :   *phObject[150]: 0
0x0000001a : 0x80b69740 :   *phObject[151]: 0
0x0000001a : 0x80b69740 :   *phObject[152]: 0
0x0000001a : 0x80b69740 :   *phObject[153]: 0
0x0000001a : 0x80b69740 :   *phObject[154]: 0
0x0000001a : 0x80b69740 :   *phObject[155]: 0
0x0000001a : 0x80b69740 :   *phObject[156]: 0
0x0000001a : 0x80b69740 :   *phObject[157]: 0
0x0000001a : 0x80b69740 :   *phObject[158]: 0
0x0000001a : 0x80b69740 :   *phObject[159]: 0
0x0000001a : 0x80b69740 :   *phObject[160]: 0
0x0000001a : 0x80b69740 :   *phObject[161]: 0
0x0000001a : 0x80b69740 :   *phObject[162]: 0
0x0000001a : 0x80b69740 :   *phObject[163]: 0
0x0000001a : 0x80b69740 :   *phObject[164]: 0
0x0000001a : 0x80b69740 :   *phObject[165]: 0
0x0000001a : 0x80b69740 :   *phObject[166]: 0
0x0000001a : 0x80b69740 :   *phObject[167]: 0
0x0000001a : 0x80b69740 :   *phObject[168]: 0
0x0000001a : 0x80b69740 :   *phObject[169]: 0
0x0000001a : 0x80b69740 :   *phObject[170]: 0
0x0000001a : 0x80b69740 :   *phObject[171]: 0
0x0000001a : 0x80b69740 :   *phObject[172]: 0
0x0000001a : 0x80b69740 :   *phObject[173]: 0
0x0000001a : 0x80b69740 :   *phObject[174]: 0
0x0000001a : 0x80b69740 :   *phObject[175]: 0
0x0000001a : 0x80b69740 :   *phObject[176]: 0
0x0000001a : 0x80b69740 :   *phObject[177]: 0
0x0000001a : 0x80b69740 :   *phObject[178]: 0
0x0000001a : 0x80b69740 :   *phObject[179]: 0
0x0000001a : 0x80b69740 :   *phObject[180]: 0
0x0000001a : 0x80b69740 :   *phObject[181]: 0
0x0000001a : 0x80b69740 :   *phObject[182]: 0
0x0000001a : 0x80b69740 :   *phObject[183]: 0
0x0000001a : 0x80b69740 :   *phObject[184]: 0
0x0000001a : 0x80b69740 :   *phObject[185]: 0
0x0000001a : 0x80b69740 :   *phObject[186]: 0
0x0000001a : 0x80b69740 :   *phObject[187]: 0
0x0000001a : 0x80b69740 :   *phObject[188]: 0
0x0000001a : 0x80b69740 :   *phObject[189]: 0
0x0000001a : 0x80b69740 :   *phObject[190]: 0
0x0000001a : 0x80b69740 :   *phObject[191]: 0
0x0000001a : 0x80b69740 :   *phObject[192]: 0
0x0000001a : 0x80b69740 :   *phObject[193]: 0
0x0000001a : 0x80b69740 :   *phObject[194]: 0
0x0000001a : 0x80b69740 :   *phObject[195]: 0
0x0000001a : 0x80b69740 :   *phObject[196]: 0
0x0000001a : 0x80b69740 :   *phObject[197]: 0
0x0000001a : 0x80b69740 :   *phObject[198]: 0
0x0000001a : 0x80b69740 :   *phObject[199]: 0
0x0000001a : 0x80b69740 :   *phObject[200]: 0
0x0000001a : 0x80b69740 :   *phObject[201]: 0
0x0000001a : 0x80b69740 :   *phObject[202]: 0
0x0000001a : 0x80b69740 :   *phObject[203]: 0
0x0000001a : 0x80b69740 :   *phObject[204]: 0
0x0000001a : 0x80b69740 :   *phObject[205]: 0
0x0000001a : 0x80b69740 :   *phObject[206]: 0
0x0000001a : 0x80b69740 :   *phObject[207]: 0
0x0000001a : 0x80b69740 :   *phObject[208]: 0
0x0000001a : 0x80b69740 :   *phObject[209]: 0
0x0000001a : 0x80b69740 :   *phObject[210]: 0
0x0000001a : 0x80b69740 :   *phObject[211]: 0
0x0000001a : 0x80b69740 :   *phObject[212]: 0
0x0000001a : 0x80b69740 :   *phObject[213]: 0
0x0000001a : 0x80b69740 :   *phObject[214]: 0
0x0000001a : 0x80b69740 :   *phObject[215]: 0
0x0000001a : 0x80b69740 :   *phObject[216]: 0
0x0000001a : 0x80b69740 :   *phObject[217]: 0
0x0000001a : 0x80b69740 :   *phObject[218]: 0
0x0000001a : 0x80b69740 :   *phObject[219]: 0
0x0000001a : 0x80b69740 :   *phObject[220]: 0
0x0000001a : 0x80b69740 :   *phObject[221]: 0
0x0000001a : 0x80b69740 :   *phObject[222]: 0
0x0000001a : 0x80b69740 :   *phObject[223]: 0
0x0000001a : 0x80b69740 :   *phObject[224]: 0
0x0000001a : 0x80b69740 :   *phObject[225]: 0
0x0000001a : 0x80b69740 :   *phObject[226]: 0
0x0000001a : 0x80b69740 :   *phObject[227]: 0
0x0000001a : 0x80b69740 :   *phObject[228]: 0
0x0000001a : 0x80b69740 :   *phObject[229]: 0
0x0000001a : 0x80b69740 :   *phObject[230]: 0
0x0000001a : 0x80b69740 :   *phObject[231]: 0
0x0000001a : 0x80b69740 :   *phObject[232]: 0
0x0000001a : 0x80b69740 :   *phObject[233]: 0
0x0000001a : 0x80b69740 :   *phObject[234]: 0
0x0000001a : 0x80b69740 :   *phObject[235]: 0
0x0000001a : 0x80b69740 :   *phObject[236]: 0
0x0000001a : 0x80b69740 :   *phObject[237]: 0
0x0000001a : 0x80b69740 :   *phObject[238]: 0
0x0000001a : 0x80b69740 :   *phObject[239]: 0
0x0000001a : 0x80b69740 :   *phObject[240]: 0
0x0000001a : 0x80b69740 :   *phObject[241]: 0
0x0000001a : 0x80b69740 :   *phObject[242]: 0
0x0000001a : 0x80b69740 :   *phObject[243]: 0
0x0000001a : 0x80b69740 :   *phObject[244]: 0
0x0000001a : 0x80b69740 :   *phObject[245]: 0
0x0000001a : 0x80b69740 :   *phObject[246]: 0
0x0000001a : 0x80b69740 :   *phObject[247]: 0
0x0000001a : 0x80b69740 :   *phObject[248]: 0
0x0000001a : 0x80b69740 :   *phObject[249]: 0
0x0000001a : 0x80b69740 :   *phObject[250]: 0
0x0000001a : 0x80b69740 :   *phObject[251]: 0
0x0000001a : 0x80b69740 :   *phObject[252]: 0
0x0000001a : 0x80b69740 :   *phObject[253]: 0
0x0000001a : 0x80b69740 :   *phObject[254]: 0
0x0000001a : 0x80b69740 :   *phObject[255]: 0
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:07 ***
0x0000001a : 0x80b69740 : Calling C_FindObjectsFinal
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  hSession: 1
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:07 ***
0x0000001a : 0x80b69740 : Calling C_SignInit
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  hSession: 1
0x0000001a : 0x80b69740 :  pMechanism: 0x7ffea27bc7f8
0x0000001a : 0x80b69740 :   mechanism: 1 (CKM_RSA_PKCS)
0x0000001a : 0x80b69740 :   pParameter: (nil)
0x0000001a : 0x80b69740 :   ulParameterLen: (nil)
0x0000001a : 0x80b69740 :  hKey: 12
0x0000001a : 0x80b69740 : Returning 0 (CKR_OK)
0x0000001a : 0x80b69740 : ****************************** 2024-04-11 11:05:07 ***
0x0000001a : 0x80b69740 : Calling C_Sign
0x0000001a : 0x80b69740 : Input
0x0000001a : 0x80b69740 :  hSession: 1
0x0000001a : 0x80b69740 :  pData: 0x7f26ee809e68
0x0000001a : 0x80b69740 :  *pData: HEX(48656C6C6F20576F726C64)
0x0000001a : 0x80b69740 :  ulDataLen: 11
0x0000001a : 0x80b69740 :  pSignature: (nil)
0x0000001a : 0x80b69740 :  pulSignatureLen: 0x7ffea27bc7e8
0x0000001a : 0x80b69740 :  *pulSignatureLen: 0
0x0000001a : 0x80b69740 : Returning 32 (CKR_DATA_INVALID)
@jariq
Copy link
Member

jariq commented Apr 11, 2024

If you want to use CKM_RSA_PKCS mechanism, you need to compute hash e.g. SHA256 of the input data, put that hash into DigestInfo structure defined in PKCS#1 and pass DER encoded structure to session.Sign method.

You can take a look at Pkcs11Admin code for a working code sample: https://github.com/Pkcs11Admin/Pkcs11Admin/blob/0.6.0/src/Pkcs11Admin/Pkcs11Slot.cs#L1066-L1073

Or maybe even better solution would be to use convenient Pkcs11Interop.X509Store library which contains Pkcs11RsaProvider class that does exactly what you are trying to achieve with your code and can be integrated with quite a few of standard .NET classes.

@jariq jariq added the question label Apr 11, 2024
@jariq jariq self-assigned this Apr 11, 2024
@NxSoftware
Copy link
Author

NxSoftware commented Apr 11, 2024

@jariq hmm that won’t work for us, we need the signature to be attached to the original file as per Apple’s requirements: https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234104

To sign a profile, place the XML property list in a DER-encoded, CMS Signed Data structure.

The resulting XML is still visible in a binary file with the signature wrapping the XML content.

It’s the equivalent of using the openssl cms -sign command with the -nodetach flag.

Our existing signing code using a locally available X509 cert & private key pair, which works with arbitrary data (i.e. not hashes) looks like this if that helps:

public byte[] Sign(X509Certificate2 signingCertificate, byte[] bytesToSign)
{
    if (bytesToSign == null)
    {
        throw new ArgumentNullException(paramName: nameof(bytesToSign));
    }

    if (signingCertificate.HasPrivateKey == false)
    {
        throw new NotSupportedException("The signing certificate must have a private key");
    }

    var signer = new CmsSigner(signingCertificate);

    var content = new ContentInfo(bytesToSign);

    var cms = new SignedCms(content);

    cms.ComputeSignature(signer);
    return cms.Encode();
}

To be honest the only reason I’m using CKM_RSA_PKCS is that there are only 3 mechanisms available and that one was the only one that got anywhere near working.

  • CKM_RSA_PKCS
  • CKM_RSA_PKCS_PSS
  • CKM_EDCSA

Perhaps the token that has been created for us doesn’t have the required capabilities? Apologies, I’m figuring this all out as I go 😅

@jariq
Copy link
Member

jariq commented Apr 11, 2024

You are currently experimenting with very low level RSA signatures while you need to create high-level CMS signature:

@NxSoftware
Copy link
Author

I tried the Pkcs11Interop.X509Store approach you linked earlier today but iirc the token I have doesn't have a certificate (it's currently 20:45 here so don't have the code to hand)

@NxSoftware
Copy link
Author

NxSoftware commented Apr 12, 2024

Here is the code and log output from the Pkcs11Interop.X509Store approach, no certificates are returned at all.

public static class HighLevel
{
  public static byte[] Sign(byte[] dataToSign)
  {
      var pinProvider = new CryptokiPinProvider(Constants.PIN);
      using var pkcs11Store = new Pkcs11X509Store(Constants.LoggerPath, pinProvider);
  
      foreach (var slot in pkcs11Store.Slots)
      {
          foreach (var certificate in slot.Token.Certificates)
          {
          }
      }
  
      return null;
  }
}

public class CryptokiPinProvider : IPinProvider
{
    private readonly byte[] _pin;

    public CryptokiPinProvider(string pin)
    {
        _pin = Encoding.UTF8.GetBytes(pin);
    }

    public GetPinResult GetKeyPin(
        Pkcs11X509StoreInfo storeInfo,
        Pkcs11SlotInfo slotInfo,
        Pkcs11TokenInfo tokenInfo, 
        Pkcs11X509CertificateInfo certificateInfo)
    {
        return new GetPinResult(false, _pin);
    }

    public GetPinResult GetTokenPin(
        Pkcs11X509StoreInfo storeInfo, 
        Pkcs11SlotInfo slotInfo, 
        Pkcs11TokenInfo tokenInfo)
    {
        return new GetPinResult(false, _pin);
    }
}
Expand logs
2024-04-12 07:07:58.301 DEBUG [26] [C_GetInfo@223] C_GetInfo
2024-04-12 07:07:58.333 DEBUG [26] [C_GetSlotList@249] C_GetSlotList
2024-04-12 07:07:58.346 DEBUG [26] [C_GetSlotList@249] C_GetSlotList
2024-04-12 07:07:58.360 DEBUG [26] [C_GetSlotInfo@271] C_GetSlotInfo - slotID: 1
2024-04-12 07:07:58.385 DEBUG [26] [C_GetSlotInfo@271] C_GetSlotInfo - slotID: 1
2024-04-12 07:07:58.414 DEBUG [26] [C_GetTokenInfo@291] C_GetTokenInfo - slotID: 1
2024-04-12 07:07:58.493 DEBUG [26] [C_OpenSession@385] C_OpenSession - slotID: 1
2024-04-12 07:07:58.493 INFO  [26] [{anonymous}::ReadConfig@414] No config file given, will use default configuration instead

2024-04-12 07:07:58.493 INFO  [26] [SignPath::ConfigurationProvider::BuildConfiguration@432] ApiUrl is set to https://app.signpath.io/Api
2024-04-12 07:07:58.493 DEBUG [26] [C_OpenSession@409] C_OpenSession - result: 1
2024-04-12 07:08:08.730 DEBUG [26] [C_OpenSession@385] C_OpenSession - slotID: 1
2024-04-12 07:08:08.730 INFO  [26] [{anonymous}::ReadConfig@414] No config file given, will use default configuration instead

2024-04-12 07:08:08.730 INFO  [26] [SignPath::ConfigurationProvider::BuildConfiguration@432] ApiUrl is set to https://app.signpath.io/Api
2024-04-12 07:08:08.730 DEBUG [26] [C_OpenSession@409] C_OpenSession - result: 2
2024-04-12 07:08:08.743 DEBUG [26] [C_GetSessionInfo@444] C_GetSessionInfo - hSession: 2
2024-04-12 07:08:08.765 DEBUG [26] [C_Login@464] C_Login - hSession: 1
2024-04-12 07:08:08.765 INFO  [26] [{anonymous}::ReadConfig@414] No config file given, will use default configuration instead

2024-04-12 07:08:08.765 INFO  [26] [SignPath::ConfigurationProvider::BuildConfiguration@432] ApiUrl is set to https://app.signpath.io/Api
2024-04-12 07:08:08.765 INFO  [26] [SignPath::RestService::DoFetchSigningPolicies@186] GET /v1/REDACTED/Cryptoki/MySigningPolicies
2024-04-12 07:08:08.766 INFO  [26] [SignPath::getHttpClientConfig@145] TlsClientCertificate not set, no client certificate authentication will be used.
2024-04-12 07:08:09.190 DEBUG [26] [SignPath::RestService::FetchSigningPolicies@158] DoFetchSigningPolicies returned <SIGNPATH API RESPONSE REDACTED>
2024-04-12 07:08:09.190 DEBUG [26] [C_Login@527] Fetching finished successfully.
Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.18/System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
2024-04-12 07:08:09.234 DEBUG [26] [C_FindObjectsInit@629] C_FindObjectsInit - hSession: 2, 3 attributes:
2024-04-12 07:08:09.234 DEBUG [26] [C_FindObjectsInit@633] 	Attribute: CKA_CLASS CKO_CERTIFICATE
2024-04-12 07:08:09.234 DEBUG [26] [C_FindObjectsInit@633] 	Attribute: CKA_TOKEN 1
2024-04-12 07:08:09.234 DEBUG [26] [C_FindObjectsInit@633] 	Attribute: CKA_CERTIFICATE_TYPE 00 00 00 00 00 00 00 00 
2024-04-12 07:08:09.545 DEBUG [26] [C_FindObjects@659] C_FindObjects - hSession: 2
2024-04-12 07:08:09.545 DEBUG [26] [C_FindObjects@681] ## found 0 objects
2024-04-12 07:08:09.861 DEBUG [26] [C_FindObjectsFinal@690] C_FindObjectsFinal - hSession: 2
2024-04-12 07:08:09.867 DEBUG [26] [C_CloseSession@417] C_CloseSession - hSession: 2

Meanwhile using openssl directly it works fine:

openssl cms -engine pkcs11 -signer signpath.pem -inkey "pkcs11:id=$KEY_ID;type=private" -keyform engine -sign -in input.txt -outform DER -nodetach

And the logs:

Expand me
2024-04-12 07:34:00.631 DEBUG [807] [C_GetInfo@223] C_GetInfo
2024-04-12 07:34:00.634 DEBUG [807] [C_GetSlotList@249] C_GetSlotList
2024-04-12 07:34:00.634 DEBUG [807] [C_GetSlotList@249] C_GetSlotList
2024-04-12 07:34:00.634 DEBUG [807] [C_GetSlotInfo@271] C_GetSlotInfo - slotID: 1
2024-04-12 07:34:00.634 DEBUG [807] [C_GetTokenInfo@291] C_GetTokenInfo - slotID: 1
2024-04-12 07:34:00.634 DEBUG [807] [C_OpenSession@385] C_OpenSession - slotID: 1
2024-04-12 07:34:00.635 INFO  [807] [SignPath::ConfigurationProvider::BuildConfiguration@432] ApiUrl is set to https://app.signpath.io/Api
2024-04-12 07:34:00.635 DEBUG [807] [C_OpenSession@409] C_OpenSession - result: 1
2024-04-12 07:34:00.635 DEBUG [807] [C_FindObjectsInit@629] C_FindObjectsInit - hSession: 1, 1 attributes:
2024-04-12 07:34:00.635 DEBUG [807] [C_FindObjectsInit@633] 	Attribute: CKA_CLASS CKO_PRIVATE_KEY
2024-04-12 07:34:00.636 DEBUG [807] [C_FindObjects@659] C_FindObjects - hSession: 1
2024-04-12 07:34:00.636 DEBUG [807] [C_FindObjects@681] ## found 0 objects
2024-04-12 07:34:00.636 DEBUG [807] [C_FindObjectsFinal@690] C_FindObjectsFinal - hSession: 1
2024-04-12 07:34:00.636 DEBUG [807] [C_GetSessionInfo@444] C_GetSessionInfo - hSession: 1
2024-04-12 07:34:00.636 DEBUG [807] [C_Login@464] C_Login - hSession: 1
2024-04-12 07:34:00.637 INFO  [807] [SignPath::ConfigurationProvider::BuildConfiguration@432] ApiUrl is set to https://app.signpath.io/Api
2024-04-12 07:34:00.637 INFO  [807] [SignPath::ConfigurationProvider::BuildConfiguration@432] ApiUrl is set to https://app.signpath.io/Api
2024-04-12 07:34:00.638 INFO  [807] [SignPath::RestService::DoFetchSigningPolicies@186] GET /v1/REDACTED/Cryptoki/MySigningPolicies
2024-04-12 07:34:00.643 INFO  [807] [SignPath::getHttpClientConfig@145] TlsClientCertificate not set, no client certificate authentication will be used.
2024-04-12 07:34:00.922 DEBUG [807] [SignPath::RestService::FetchSigningPolicies@158] DoFetchSigningPolicies returned <SIGNPATH API RESPONSE REDACTED>
2024-04-12 07:34:00.925 DEBUG [807] [C_Login@527] Fetching finished successfully.
2024-04-12 07:34:00.925 DEBUG [807] [C_FindObjectsInit@629] C_FindObjectsInit - hSession: 1, 1 attributes:
2024-04-12 07:34:00.925 DEBUG [807] [C_FindObjectsInit@633] 	Attribute: CKA_CLASS CKO_PRIVATE_KEY
2024-04-12 07:34:00.925 DEBUG [807] [C_FindObjects@659] C_FindObjects - hSession: 1
2024-04-12 07:34:00.925 DEBUG [807] [C_FindObjects@677] 	result[0]: 2
2024-04-12 07:34:00.925 DEBUG [807] [C_FindObjects@681] ## found 1 objects
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_KEY_TYPE
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@586] 	Object: 2
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@586] 	Object: 2
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@586] 	Object: 2
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@586] 	Object: 2
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@586] 	Object: 2
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@586] 	Object: 2
2024-04-12 07:34:00.925 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.925 DEBUG [807] [C_FindObjects@659] C_FindObjects - hSession: 1
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@677] 	result[0]: 4
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@681] ## found 1 objects
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_KEY_TYPE
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 4
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 4
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 4
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 4
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 4
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 4
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@659] C_FindObjects - hSession: 1
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@677] 	result[0]: 6
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@681] ## found 1 objects
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_KEY_TYPE
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 6
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 6
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 6
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 6
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 6
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 6
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@659] C_FindObjects - hSession: 1
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@677] 	result[0]: 8
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@681] ## found 1 objects
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_KEY_TYPE
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 8
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 8
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 8
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 8
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 8
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 8
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@659] C_FindObjects - hSession: 1
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@677] 	result[0]: 10
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@681] ## found 1 objects
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_KEY_TYPE
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 10
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 10
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 10
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 10
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 10
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 10
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@659] C_FindObjects - hSession: 1
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@677] 	result[0]: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@681] ## found 1 objects
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_KEY_TYPE
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@659] C_FindObjects - hSession: 1
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@677] 	result[0]: 14
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@681] ## found 1 objects
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_KEY_TYPE
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 14
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 14
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_LABEL
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 14
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 14
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 14
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ID
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 14
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@659] C_FindObjects - hSession: 1
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjects@681] ## found 0 objects
2024-04-12 07:34:00.926 DEBUG [807] [C_FindObjectsFinal@690] C_FindObjectsFinal - hSession: 1
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_MODULUS
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_MODULUS
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_PUBLIC_EXPONENT
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_PUBLIC_EXPONENT
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.926 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.927 DEBUG [807] [C_GetAttributeValue@563] C_GetAttributeValue - hSession: 1, 1 attributes:
2024-04-12 07:34:00.927 DEBUG [807] [C_GetAttributeValue@569] 	Attribute: CKA_ALWAYS_AUTHENTICATE
2024-04-12 07:34:00.927 DEBUG [807] [C_GetAttributeValue@586] 	Object: 12
2024-04-12 07:34:00.927 DEBUG [807] [C_GetAttributeValue@615] GetAttributeValue - result 0
2024-04-12 07:34:00.930 DEBUG [807] [C_SignInit@707] C_SignInit - hSession: 1, mechanism: 1
2024-04-12 07:34:00.930 DEBUG [807] [C_SignInit@746] Signing with signing policy ID 12 REDACTED
2024-04-12 07:34:00.930 DEBUG [807] [C_Sign@806] C_Sign - hSession: 1, dataLen: 51, pSignature: 0x55555567a9e0, signatureLen: 512
2024-04-12 07:34:00.933 INFO  [807] [SignPath::RestService::Sign@495] POST /v1/REDACTED/SigningRequests; body:
------SignPathClient-0ernByyk5DSa6pgT
Content-Disposition: form-data; name="SigningPolicyId"

REDACTED
------SignPathClient-0ernByyk5DSa6pgT
Content-Disposition: form-data; name="IsFastSigningRequest"

true
------SignPathClient-0ernByyk5DSa6pgT
Content-Disposition: form-data; name="Artifact"; filename="payload.json"
Content-Type: application/json

{"Base64EncodedHash":"FItDoj/zDHM75k1FSGv+81+DZhhAfmh1i8fyWARpuBE=","SignatureAlgorithm":"RsaPkcs1","RsaHashAlgorithm":"2.16.840.1.101.3.4.2.1","Metadata":{"CreatingProcess":{"CommandLine":"/usr/bin/openssl openssl cms -engine pkcs11 -signer signpath.pem -inkey pkcs11:id=REDACTED;type=private -keyform engine -sign -in nuget.config -outform DER -nodetach","User":"root"}}}
------SignPathClient-0ernByyk5DSa6pgT--

2024-04-12 07:34:01.345 INFO  [807] [SignPath::RestService::Sign@503] Response JSON:{"Base64EncodedHash":"FItDoj/zDHM75k1FSGv+81+DZhhAfmh1i8fyWARpuBE=","Metadata":{"CreatingProcess":{"CommandLine":"/usr/bin/openssl openssl cms -engine pkcs11 -signer signpath.pem -inkey pkcs11:id=REDACTED;type=private -keyform engine -sign -in nuget.config -outform DER -nodetach","User":"root"}},"RsaHashAlgorithm":"2.16.840.1.101.3.4.2.1","Signature":"N/C1QlzOqnh+aH6rCfJZ7MD3EDZZjQ0HMG8FilOI9s0d+p0B0ap+1Bru/TBr6IEK0wCpEbbfG2QBLd//r3N7sWh/rzIIENkr09D1ujGVdg6lm+S/gepoN7wgt+kDed6tg9bPDCV+kqts6L1Onvbww38nPiP6Vn8njyNhiNAWB8wR3AeEeR73ipjNoWTExEKxVEZm1EbZ2A8elyEydMjalb6sjdFezOLOsLK+9HBUEk3rk6zWHUwFh4B3yEFEbrofEMWO3DBu3YDd/YYDjszNKewSdwUUY+GzW028inphuqcWxxv4oTgVPKjCdS67SrqzoP9PDmFQlln92HdtiUVMpMwOFsC8rX2xV4iHcEWSl7YTuACeOnk2w7xO+HV8mewUAt3kOg5PfDK87IK4B2U3sizlFhumrifAhU18EznjQ5Nn4x7cPBJ6PVarQQao8L0x892aShpZeVE16aXmKwUJYWpudFu8nS9e2ZwYgy7F0bm46gOUiW5U6IsXkYYpveUKaWwT4hKbCsF2BGu1Bt7Nyw7hYxoYMfV3Zt5TO5nhKwbr2JS+S1fsjtYeKHWQ4W2B2i/x+tx/HRnhTMsGjxh0asWBpImP8sNK/tzbH1yi2B2REGGiBF2bb30vb33IKSq99mo6f2eWkj8fA5G/6bk8EozfxENkUdLu5eKGD+saYzE=","SignatureAlgorithm":"RsaPkcs1"}

<SIGNED OUTPUT REDACTED>

@jariq
Copy link
Member

jariq commented Apr 18, 2024

Import certificate stored in signpath.pem file into your HSM with Pkcs11Admin application and try to use Pkcs11Interop.X509Store again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants