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

Windows-ROOT as truststore #18020

Closed
amaljesudas opened this issue Apr 1, 2022 · 13 comments
Closed

Windows-ROOT as truststore #18020

amaljesudas opened this issue Apr 1, 2022 · 13 comments
Assignees
Labels
triaged: feature The issue/pr requests/adds a feature

Comments

@amaljesudas
Copy link

Is there a way to set Windows-ROOT (or any Windows Certificate Store in general) as truststore in openssl?
I think java has some similar feature.

Thanks in advance.

@amaljesudas amaljesudas added the issue: question The issue was opened to ask a question label Apr 1, 2022
@hlandau
Copy link
Member

hlandau commented Apr 2, 2022

OpenSSL has never had code to load the Windows certificate store itself. It's a somewhat surprising asymmetry given that it does have code to load the system certificate store on *nix and it already is willing to use the Win32 crypto API for some things (like CryptGenRandom).

It's only about 35 lines of code to do this though. Here's some (now rather old) code of mine (not guaranteed, but feel free to use): https://gist.github.com/hlandau/7a9a8146af25a2c972aa1fe400a8a60f

@mattcaswell Do we want this functionality?

@hlandau hlandau added triaged: question The issue contains a question and removed issue: question The issue was opened to ask a question labels Apr 2, 2022
@kroeckx
Copy link
Member

kroeckx commented Apr 2, 2022 via email

@amaljesudas
Copy link
Author

@hlandau

Thanks for the info and code Hugo.
I did try a similar implementation to what you provided, but was not able to get my connection to work (could be some other issue, checking on it).
As you mentioned, OpenSSL does not have direct code to load from Windows Certificate Store.
Do you know why this is not implemented? Is it because of some known issue or use case limitation?
Just wanted to know from an academic perspective.

@t8m
Copy link
Member

t8m commented Apr 5, 2022

Do you know why this is not implemented? Is it because of some known issue or use case limitation?

In general OpenSSL is an open source software which means a feature gets implemented when someone who needs it submits a code that implements the feature. So the answer is that nobody submitted the code that implements Windows cert store support.

Why nobody did that that's another question which we probably cannot answer.

@hlandau
Copy link
Member

hlandau commented Apr 5, 2022

@t8m Would we be interested in this functionality? I have code to do it lying around and it seems like basically anyone using libssl on Windows will need it. I could make a PR.

@t8m
Copy link
Member

t8m commented Apr 5, 2022

I do not see why we would not want it. The difficult question would be how that windows cert store will be enabled. I.E. making it enabled by default on Windows might be considered a too big change for 3.1 by some.

@hlandau hlandau self-assigned this Apr 5, 2022
@hlandau hlandau added triaged: feature The issue/pr requests/adds a feature and removed triaged: question The issue contains a question labels Apr 5, 2022
@paulidale
Copy link
Contributor

The question for me is would this impact the 3.1 development times?

@hlandau
Copy link
Member

hlandau commented Apr 5, 2022

It's not much code. About 35 lines. I already have it from my own projects. Biggest timesink would just be agreeing the API/how it interacts with existing functions.

@t8m
Copy link
Member

t8m commented Apr 5, 2022

Ideally it would be done in terms of OSSL_STORE provider instead of adding certs to X509_STORE which complicates that 35 line code quite some.

@levitte
Copy link
Member

levitte commented Jun 14, 2022

A minimum provider that does this only needs an OSSL_STORE loader with export capabilities. That's enough to handle any key where the key data is programmatically accessible (i.e. exportable) and shouldn't be too hard to do. The main thing will probably be to design the URI scheme and implement its parser.

@levitte
Copy link
Member

levitte commented Jun 14, 2022

... when we do design such a URI scheme, we probably should register it properly too. I know that I've mentioned the sneaky way of avoiding that, but I frankly think making it official is the better move in the long run.

@hlandau
Copy link
Member

hlandau commented Jun 14, 2022

@levitte See #18070? Currently the issue is that SSL_CERT_DIR is interpreted both as a colon-separated list of paths and as a store URI.

@levitte
Copy link
Member

levitte commented Jun 14, 2022

Ah, thanks for the reminder.

hlandau added a commit to hlandau/openssl that referenced this issue Jun 29, 2022
hlandau added a commit to hlandau/openssl that referenced this issue Jul 25, 2022
hlandau added a commit to hlandau/openssl that referenced this issue Aug 19, 2022
hlandau added a commit to hlandau/openssl that referenced this issue Aug 19, 2022
hlandau added a commit to hlandau/openssl that referenced this issue Sep 8, 2022
hlandau added a commit to hlandau/openssl that referenced this issue Sep 13, 2022
sftcd pushed a commit to sftcd/openssl that referenced this issue Sep 24, 2022
Fixes openssl#18020.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#18070)
beldmit pushed a commit to beldmit/openssl that referenced this issue Dec 26, 2022
Fixes openssl#18020.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from openssl#18070)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged: feature The issue/pr requests/adds a feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants