Closed Sangeetha-E closed 11 months ago
Is the certificate object public?
Sorry. I am not familiar with the concept. I am unsure about the process of creating a public certificate. Could you kindly provide me with the necessary steps and guidance on how to create a public certificate?
Please dump the content of the token using opensc pkcs11-tool list objects, make sure tha the CKO_CERTIFICATE object available and has the same CKA_ID of the CKO_PRIVATE_KEY object's CKA_ID. Please also make sure that the CKO_CERTIFICATE object is set as CKA_PRIVATE=FALSE, this way access will be permitted without authentication. Please contact someone who can help you set everything up and reopen issue if you are sure these settings are correct and attach the output of the dump.
I have implemented the settings as per your instructions. But, I continue to encounter the same issue. For your reference, I have attached a document detailing the steps taken and the log files. Please consider reviewing and rectifying any errors I may have made.
Hi,
The certificate looks OK, however, you dumped the token content without login so I cannot see the private objects.
Oh, you are using /usr/lib/softhsm/libsofthsm2.so
to test, it does not support slot events[1], you cannot use the unit test to test it.
What application you want to use? Maybe better to skip this unit test and go ahead and try to use it.
Alon
Hi Thank you for your prompt response. Is there any way to test this package without real hardware?
Testing is not trivial.
You should first make sure your token content is correct by dumping with login.
You should not use sudo at all, please see [1], use SOFTHSM2_CONF
and define your own user configuration.
You can specify --with-test-log-level=255
to see some more logs in test-certificate
which should pass if you set up everything correctly.
[1] https://man.archlinux.org/man/softhsm2.conf.5.en#SOFTHSM2_CONF
Thank you for your recommendation. I will certainly give it a try.
I followed your suggestions, but I am still encountering the same issue. I have attached the log for your reference, and I kindly request your assistance in reviewing it to confirm if this is the expected result.
Here are the steps I've taken as per your suggestions:
SOFTHSM2_CONF
environment variable as you suggested. This allowed me to run test programs without needing to use sudo
.--with-test-log-level=255
option.One thing to note about SoftHSM2 is that it behaves like this:
Here's a sample log:
$ softhsm2-util --show-slots
Available slots:
Slot 138779972
Slot info:
Description: SoftHSM slot ID 0x8459d44
Manufacturer ID: SoftHSM project
Hardware version: 2.5
Firmware version: 2.5
Token present: yes
Token info:
Manufacturer ID: SoftHSM project
Model: SoftHSM v2
Hardware version: 2.5
Firmware version: 2.5
Serial number: 42042b5808459d44
Initialized: yes
User PIN init.: yes
Label: MyToken
Slot 611509298
Slot info:
Description: SoftHSM slot ID 0x2472e432
Manufacturer ID: SoftHSM project
Hardware version: 2.5
Firmware version: 2.5
Token present: yes
Token info:
Manufacturer ID: SoftHSM project
Model: SoftHSM v2
Hardware version: 2.5
Firmware version: 2.5
Serial number: 8966120c2472e432
Initialized: yes
User PIN init.: yes
Label: MyToken
Slot 2
Slot info:
Description: SoftHSM slot ID 0x2
Manufacturer ID: SoftHSM project
Hardware version: 2.5
Firmware version: 2.5
Token present: yes
Token info:
Manufacturer ID: SoftHSM project
Model: SoftHSM v2
Hardware version: 2.5
Firmware version: 2.5
Serial number:
Initialized: no
User PIN init.: no
Label:
The test-certificate
test would never succeed with softhsm2 as it first asks you to remove all tokens and expects to find zero certificates at that point. This is not possible with softhsm.
However, one can still use it as a manual test by running at a high log level as you have done --- it would then print the DN of all certificates found before erroring out with "No certificates should be found". This works for me. The uninitialized slot automatically created by softhsm2 is not a problem.
In your case, even this initial scanning finds no objects. For the two initialized slots in the token, logs show zero objects found: PKCS#11: _pkcs11h_session_findObjects return rv=0-'CKR_OK', *p_objects_found=0
. Please confirm that pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --list-objects
(run without sudo) does list your certificates with the new SOFTHSM2_CONF setting active.
Hi,
While running the tests, I encountered the following issue.
Here are the steps I followed to run the tests:
Kindly give me suggestions to solve this issue.