-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
[HTTPS] Adds PEM support for Kestrel #23584
Conversation
ef00f9f
to
fbe5489
Compare
How long will ECC support take to add? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to discuss this a bit before merging @javiercn to make sure it aligns with the other features we're doing here.
Like 30 minutes? I forgot to add them in the first place |
Hehe. OK if this gets updated for ECC then I'm good with it, once Jeremy's concerns are addressed |
|
5bac8d3
to
2e68fd3
Compare
🆙📅 The only thing left is to determine is if we need to handle more OIDs to support the current keys. |
We've discussed this offline, I've capture the feedback here. I think we are still missing some update on the runtime before we can load certificate collection/chains, but that should build on top of this PR. Once we have an updated BCL with these APIs we can complete the work described in #23623 I think this is ready to go % build passes /cc: @davidfowl |
@javiercn a couple follow up items:
|
There's LoadFromPemFile on che BCL, which is waht you would use. |
Why don’t we use it? |
Cause the API is PEM + PEM and I wanted to also support loading the cert in DER format, so we load the CERT (PEM or DER) and then we load the key separately and marry it to the cert.
I would say if it is safe to double dispose certificates we just dispose all certificates on shutdown, otherwise we just dispose the ones loaded from config. |
Right, should we have an API for this? Or is it too niche? |
I'm not sure how niche it is, PEM+PEM is likely way more popular, but I want to support if for convenience, so you don't have to use a tool to change the cert format. Some of the dev-servers that I used support this and it is convenient not to require a tool to change the format. For example, you can use our dev cert with the angular dev server proxy by passing the cert in DER format and the key in PEM format, which is what we plan to do. |
Yep, certificate disposal is well-behaved. |
logger.FailedToLoadCertificateKey(certificateKeyPath); | ||
} | ||
|
||
throw new InvalidOperationException(CoreStrings.InvalidPemKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could throw if the cert is missing, not just because the key was missing or invalid right? This exception message implies the key must be the problem?
And why do we use the exact same exception and log message any time the key is missing or invalid? It would be a lot better to log exactly why the key is invalid and to be very clear when the key is actually missing vs being invalid in both the exception and log messages.
Open questions.
Addresses #4706