Description
The RemoteCertificateValidationCallback
is documented as being able to access these values and potentially choose to reject the connection based on them:
The security protocol and cryptographic algorithms are already selected when the
userCertificateValidationCallback
delegate's method is invoked. You can use the method to determine whether the selected cryptographic algorithms and strengths are sufficient for your application. If not, the method should return false to prevent theSslStream
from being created.
Currently this doesn't work, because attempting to access them throws an InvalidOperationException
. Ideally, please can this be fixed to work as documented (I only skimmed the code briefly but I don't see any need for the authSuccessCheck
here?).
If it's not practical to make it work as advertised for some reason, please can the documentation be fixed - which I will happily do myself if someone points me in the direction of the right place to PR.
N.B. I am trying to implement this with AuthenticateAsServer()
, I haven't checked whether it may work as documented for a client-side stream, I will try it out when I can and update the issue if no-one else has checked it first.
Related to https://github.com/dotnet/corefx/issues/24588 / https://github.com/dotnet/corefx/issues/21577 in the sense that if I was able to specify the cipher set that can be used, I wouldn't need to do this as I could simply disable the ciphers I want to disallow with high-level configuration rather than manually checking per-connection.