Updated CertificateValidationCallBack to build the CaCert bundle with respect to the rootChain certs to verify that they are correct. (#860)
* Updated CertificateValidationCallBack to build the CaCert bundle with respect to the rootChain certs to verify that they are correct. * Added a test cases and assets for when all the certs files are in the same file. * Removed the hardcoded first cert as the chosen root cert
This commit is contained in:
@@ -203,13 +203,11 @@ namespace k8s
|
||||
|
||||
var isTrusted = false;
|
||||
|
||||
var rootCert = chain.ChainElements[chain.ChainElements.Count - 1].Certificate;
|
||||
|
||||
// Make sure that one of our trusted certs exists in the chain provided by the server.
|
||||
//
|
||||
foreach (var cert in caCerts)
|
||||
{
|
||||
if (rootCert.RawData.SequenceEqual(cert.RawData))
|
||||
if (chain.Build(cert))
|
||||
{
|
||||
isTrusted = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user