-
Notifications
You must be signed in to change notification settings - Fork 32
Key and Certificate ID Mismatch in MacOS Provider #557
Comments
While debugging webcrypto-local for certificate import, I discovered an inconsistency in the behavior of the Here's the relevant code snippet: const id = await this.computeID();
// ... (other code)
this.p11Object = this.crypto.session.create(template).toType();
console.log(template.id.toString("hex")); // Outputs '73e4ac6199ba1ff0c29b44a72d643f43'
console.log(this.p11Object.id.toString("hex")); // Outputs '2d0cf479b87f65381e211287443ade9f1413b666' The This appears to be a bug within the MacOS |
I have opened an issue in the pvpkcs11 repository to address this. You can find more details and follow the progress here: PeculiarVentures/pvpkcs11#56 |
I've fixed the C_CreateObject issue in pvpkcs11. You can grab the updated library from the artifacts here: GitHub Actions Run. I've tested it on my macOS and Windows setups. It'd be great if someone else could also give it a try. |
This fix works for me on MacOS |
Fix works for me on Win 10 too. |
Thank you, @WorldThirteen, for the test |
Description
When adding keys and a certificate to the MacOS provider via Fortify, their IDs differ, causing the application to be unable to associate the key with the certificate. Consequently, they are not displayed in the list. If the application is restarted, the certificate and keys will have the same identifiers, and the certificate will be displayed.
Steps to Reproduce
Expected Behavior
The certificate should remain in the list even after a browser refresh and should be properly associated with its corresponding key.
Actual Behavior
The certificate is not displayed in the list after a browser refresh due to differing IDs for the key and certificate.
Additional Information
This could be an issue with either
node-webcrypto-p11
orpvpkcs11
. When the same procedure is executed on SoftHSM, everything works as expected. It seems that thepvpkcs11
module may not be assigning theCKA_ID
to the key object. The application sets this property using the hash of the public key after key generation. Upon restarting the application,pvpkcs11
appears to recalculateCKA_ID
.Interestingly, the certificate ID remains unchanged after an application restart. This suggests that the issue might not be with the key's
CKA_ID
, but rather with the certificate's. Further investigation is needed to pinpoint the issue.The text was updated successfully, but these errors were encountered: