Comments (9)
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.
Any update on this issue? Will you be able to provide me with the logs?
from pkcs11interop.
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.
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.
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.
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.
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.
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.
OK then. Let's agree that problem is on your side
from pkcs11interop.
Related Issues (20)
- Private key is not in certificate
- Method C_OpenSession returned CKR_CRYPTOKI_NOT_INITIALIZED
- Pkcs11Interop is not supported on this platform HOT 25
- Missing attribute CKA_NAME_HASH_ALGORITHM
- problem in Pkcs11Interop with new dll from epass 2003
- CKR_OPERATION_NOT_INITIALIZED in multithreaded application
- Missing param represents object handle
- Method C_Login returned CKR_SESSION_HANDLE_INVALID
- Incorrect CK_VERSION string value
- Get Key Value From HSM
- Not able to use C_Sign with yubikey PIV slot with CKA_ALWAYS_AUTHENTICATE HOT 5
- Linux : NativeULong as System.UInt32 causes error while accessing CK_GCM_PARAMS structure from PKCS11 standards HOT 2
- mac os compile problem MAUI .net core 7.0 how to fix ?
- SafeNet Data Objects HOT 7
- ComputeDigest/CreateDigestInfo - with newest Pkcs11Interop - how to ?
- C_Sign returned CKR_OPERATION_NOT_INITIALIZED in multithreaded application
- C_Encrypt with AES mechanism always returns with CKR_GENERAL_ERROR HOT 1
- C_FindObjects does return with nothing while running application in docker
- C_FindObjects does return with nothing while running application in docker HOT 3
- session.Decrypt returning garbage characters appended in PKCS#11 Multipart Decryption with Pkcs11Interop v 4.x.x
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pkcs11interop.