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

Fix pkcs11 uri checking for key files. #16591

Closed
wants to merge 1 commit into from
Closed

Conversation

martxel
Copy link

@martxel martxel commented Mar 6, 2025

I have found this issue when trying to use the new PKCS#11 provider support in curl.

I was getting the following error when trying to use a pkcs11 uri as a key, in curl 8.12.1:

* crypto provider not set, cannot load private key
* closing connection #0
curl: (58) crypto provider not set, cannot load private key

After checking the code that prints the error, I have found out that it is incorrectly checking if cert_file is a pkcs11 uri, instead of checking key_file:

https://github.com/curl/curl/blob/curl-8_12_1/lib/vtls/openssl.c#L1678

Probably a copy-paste error.

@testclutch
Copy link

Analysis of PR #16591 at eb2ec28a:

Test 312 failed, which has NOT been flaky recently, so there could be a real issue in this PR.

Generated by Testclutch

@Jakuje
Copy link
Contributor

Jakuje commented Mar 6, 2025

Thank you for the fixup! You are right. This was copy&paste error. I miseed this as I tested with both key and cert in pkcs11. This will surface only if the cert is in file and key in pkcs11 provider.

@martxel
Copy link
Author

martxel commented Mar 6, 2025

Yes, I found this error because in my scenario I'm using a key in the TPM, and a certificate in a file.

Thanks to you for adding support por PKCS#11 provider, you have saved me quite a bit of work.

@bagder bagder closed this in f5cb83e Mar 6, 2025
@bagder
Copy link
Member

bagder commented Mar 6, 2025

Thanks!

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

Successfully merging this pull request may close these issues.

4 participants