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

Updated to fix an error with token from Cryptas and nCipher (attribute length can be 0xffffffff) #155

Closed
wants to merge 5 commits into from

Conversation

xnop
Copy link

@xnop xnop commented May 27, 2020

error

attribute length conversion cause an error in Pkcs11Admin tool with Cryptas or nCipher HSM

@jariq
Copy link
Member

jariq commented May 31, 2020

Thanks for the PR but it's quite difficult for me to review your changes without any description.
Could you please provide more information about the attribute that caused you a problem and attach log from Pkcs11Admin?

@jariq jariq self-assigned this May 31, 2020
@xnop
Copy link
Author

xnop commented May 31, 2020

Sure I will send you more details about the attribute. The exception is risen in GetAttributeValue functions and I made changes in ConvertValue too, if I remember, it occurred when I reloaded the the library module.

BTW, the version 0.4 of Pkcs11Admin works fine, no error with both HSMs.

@xnop
Copy link
Author

xnop commented Jun 1, 2020

The attribute that rises an exception is :

CKA_WRAP_TEMPLATE = (CKF.CKF_ARRAY_ATTRIBUTE | 0x00000211)

the content of item 17 of attributes of a RSA public key with TicTok token from Cryptas:

  •   [17]	{Net.Pkcs11Interop.LowLevelAPI41.CK_ATTRIBUTE}	Net.Pkcs11Interop.LowLevelAPI41.CK_ATTRIBUTE
      @type	0x40000211	uint
    
  •   value	0x0000000000000000	System.IntPtr
      valueLen	0xffffffff	uint
    

occurs when launching the application:

Pkcs11Interop.dll!Net.Pkcs11Interop.HighLevelAPI41.Session.GetAttributeValue(Net.Pkcs11Interop.HighLevelAPI.IObjectHandle objectHandle, System.Collections.Generic.List attributes) Line 617 C#
Pkcs11Admin.dll!Net.Pkcs11Admin.Pkcs11Slot.ReadKeys(Net.Pkcs11Interop.Common.CKO objectClass, Net.Pkcs11Admin.Configuration.ClassAttributesDefinition keyAttributes) Line 580 C#
Pkcs11Admin.dll!Net.Pkcs11Admin.Pkcs11Slot.ReadKeys() Line 607 C#
Pkcs11Admin.dll!Net.Pkcs11Admin.Pkcs11Slot.Reload(bool onlySlotInfo) Line 353 C#
Pkcs11Admin.dll!Net.Pkcs11Admin.Pkcs11Slot.Reload() Line 241 C#

and while quitting the application:

Pkcs11Interop.dll!Net.Pkcs11Interop.LowLevelAPI41.CkaUtils.ConvertValue(ref Net.Pkcs11Interop.LowLevelAPI41.CK_ATTRIBUTE attribute, out Net.Pkcs11Interop.LowLevelAPI41.CK_ATTRIBUTE[] value) Line 369 C#
Pkcs11Interop.dll!Net.Pkcs11Interop.HighLevelAPI41.ObjectAttribute.FreeAttribute(ref Net.Pkcs11Interop.LowLevelAPI41.CK_ATTRIBUTE attribute) Line 702 C#
Pkcs11Interop.dll!Net.Pkcs11Interop.HighLevelAPI41.ObjectAttribute.Dispose(bool disposing) Line 687 C#
Pkcs11Interop.dll!Net.Pkcs11Interop.HighLevelAPI41.ObjectAttribute.~ObjectAttribute() Line 720 C#

Hope this helps.

Please let me know whether your need more details or a trace with pkcs11-logger.

Daniel

@xnop xnop closed this Jun 1, 2020
@xnop xnop reopened this Jun 1, 2020
@xnop
Copy link
Author

xnop commented Jun 4, 2020

logs.zip
Please find the logs for TicTok and nCipher HSM. Hope this helps.

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

Successfully merging this pull request may close these issues.

None yet

2 participants