[HTTPS] Adds PEM support for Kestrel#23584
Conversation
ef00f9f to
fbe5489
Compare
|
How long will ECC support take to add? |
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.
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