Giter VIP home page Giter VIP logo

Comments (9)

jariq avatar jariq commented on June 7, 2024

I don't see any obvious error in your code other than that you are trying to read the value of binary CKA_ID attribute into the string. Please use pkcs11-logger to capture all unmanaged PKCS#11 calls made by your application and share the logs with me if you want me to provide more detailed answer.

from pkcs11interop.

jariq avatar jariq commented on June 7, 2024

Any update on this issue? Will you be able to provide me with the logs?

from pkcs11interop.

lkn2993 avatar lkn2993 commented on June 7, 2024

I'm sorry but the project was suspended due to HSM hardware issue until today.
Ill restart my work today and report back the progress in 48 hours.
Thanks for your patience and compassion about this issue.

from pkcs11interop.

lkn2993 avatar lkn2993 commented on June 7, 2024

I know this sounds a little irrelevant, but how does the GetAttributeValue works exactly, for example I want to export modulus from a public key so how that can be achieved?

There might be a problem about my understanding of this structure, that's why I'm asking.

from pkcs11interop.

jariq avatar jariq commented on June 7, 2024

First you need to find/create/generate object in order to get its ObjectHandle and after that read its attributes i.e. CKA_MODULUS with Session::GetAttributeValue method. Each attribute has its own data type defined in PKCS#11 specification so you need to read its value with an appropriate ObjectAttribute::GetValueAs* method. In case of CKA_MODULUS you need to use ObjectAttribute::GetValueAsByteArray method because it is binary attribute.

Working code sample is available as GetAttributeValueTest and more information on this topic can be found in Chapter 10 of PKCS#11 v2.20 specification.

from pkcs11interop.

lkn2993 avatar lkn2993 commented on June 7, 2024

Done and done,
The problem seems to be non existent in version 2 of your library, the null value is only returned in version 3, could be a problem with our pkcs11 dll.

The final code is:

List<CKA> pubKeyAttrsToRead = new List<CKA>();
pubKeyAttrsToRead.Add(CKA.CKA_LABEL);
pubKeyAttrsToRead.Add(CKA.CKA_ID);

List<ObjectAttribute> pubKeyAttributes =
CurrentSession.GetAttributeValue(pubKeyObjectHandle, pubKeyAttrsToRead);

Which worked properly.

However that's not top priority issue now. :)

from pkcs11interop.

jariq avatar jariq commented on June 7, 2024

Pkcs11Interop v3 is superior to Pkcs11Interop v2 in many ways and should be preferred for all applications not only because it contains many improvements but because it also fixes a lot of issues. You are stating that the same code which works with v2 does not work with v3. If this is true then you might have found a bug which was not caught by our automated tests. I would be grateful if you could use pkcs11-logger to capture all unmanaged PKCS#11 calls made by your application using Pkcs11Interop v2 and then v3 and share the logs with me so I can analyze the real cause of the problem. It should take you only a few minutes of your time and it could help me make the library (or your code) better.

from pkcs11interop.

lkn2993 avatar lkn2993 commented on June 7, 2024

I'm sorry but that simply cannot be done, the error which is returned by the application is simply beyond the pkcs11 logger responsibility(it happens in c++ code)
The error is:
Unmanaged error, value cannot be null.
which is silently bypassed if our pkcs11 dll is in release mode(but catches it in debug mode).
Do you still need more information regarding this issue? As I said its very likely that the problem is in our side.

from pkcs11interop.

jariq avatar jariq commented on June 7, 2024

OK then. Let's agree that problem is on your side ☺️. Feel free to reopen this issue if you change your mind.

from pkcs11interop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.