-
Notifications
You must be signed in to change notification settings - Fork 4.9k
System.Security: Split ICertificatePal #31284
Conversation
|
Looks good to me :-) I wouldn't mind keeping What's |
|
I made the split at whatever was used by Only tested compilation on macOS so far. It's likely that I missed some stuff in the other two implementations and I will fix it as soon as the PR builds finish. |
|
Okay, makes sense. |
| namespace Internal.Cryptography | ||
| { | ||
| /// <summary>Provides specific implementation for X509Certificate.</summary> | ||
| internal interface ICertificatePal : IDisposable |
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.
Would this be a less noisy change if the base interface name changed instead of the derived one?
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 Mono, I'm actually using an abstract class for this - this is from our mono/mono#9650.
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'm not sure that answers the question.
A whole lot of this change is changing input parameters from ICertificatePal to ICertificatePal2. if the split was ICertificateLegacyPal and ICertificatePal instead of ICertificatePal and ICertificatePal2 the change seems a whole lot smaller. (I'm flexible on the name of the "splitting this off for mscorlib-like separation" version)
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.
Well, I'm still not 100% convinced that we will actually need this.
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.
Yeah, I can split it the other way around and it definitely makes way less noise. That's what I did ~2 weeks ago for my initial quick and dirty attempt to make it all build. I couldn't come up with a good name though, but ICertificateLegacyPal sounds good.
@baulig, I am open to other options, but I know this one is definitely doable since I already have the full macOS CoreFX certificate stack running with it on Mono. I'm still maintaining that to run all the unit tests.
…tificate) and ICertificatePal (consumed by X509Certificate2).
|
Well, I strongly dislike the name How about Could we also possible turn |
|
I can take care of the For |
|
While we at it, does any of you have any strong feelings about Any objections against either adding I don't mind about the one-method interface, but the static |
|
Found one more issue, in Any objections against moving this into the PAL layer, so we can use the native validator instead of going through |
|
The ICertificatePal represents the active certificate, not an abstraction over several statics. In particular, the Apple one and the OpenSSL one each hold two pointers internally. So they'd need a very large rewrite to change them to "staticish calls with a context parameter". Perhaps all this would be easier if Mono just typeforwarded X509Certificate or X509Certificate2 so they can live in the same assembly? |
|
Any changes that need to happen here (which can be more than one) need to be very easy to review. So very minimal changes for each change. |
|
Sure, I can split it down into small pieces. And the |
|
For the
I also had a look a |
|
@baulig As for the static methods - already tracking that in separate issue (https://github.com/dotnet/corefx/issues/30606). |
|
I am open to name suggestions as long as we can agree on one. Type-forwarding was one of the considered options, but there was really no discussion about it AFAIK. At the moment there's no type forwarding from There are generally two issues that we need to deal with. First, the split between Second, Mono has a requirement that it can be compiled with more than one PAL (like OpenSSL + Apple crypto). Only one PAL would actually be used, but it would be selected at runtime and not compile time. That's what was the point of issue #30606 and @baulig's yesterday PRs for moving some code around. |
|
Of the proposed names I kinda like |
|
After thinking about of it, I like |
|
I'm fine with ICertificatePalCore |
|
Ok, I will update the PR. |
Rationale: In Mono
X509CertificateandX509Certificate2live in different assemblies, the first inmscorlib, the latter inSystem. Nearly all the other classes fromSystem.Security.Cryptography.X509Certificateslive in theSystemassembly. In order to allow Mono to reuse X509Certificate it is necessary to keep its dependencies as small as possible (noX500DistinguishedNameand noECDsa).Fortunately, that is easily achieved by splitting the
X509Certificate-specific members out of theICertificatePalinterface intoICertificateLegacyPal. Additionally, the legacyGetNameandGetIssuerNameare now implemented by newLegacySubjectNameandLegacyIssuerNameproperties inICertificatePal. An optimized version is added for the Windows PAL./cc @bartonjs @baulig