mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-05 06:34:13 -04:00
Add support for loading multiple root CAs from the specified CA file
Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
This commit is contained in:
parent
79ee70a1a2
commit
7193b5a2a2
@ -96,7 +96,8 @@ public static class RabbitMqModule
|
|||||||
if (!string.IsNullOrEmpty(caCertFile))
|
if (!string.IsNullOrEmpty(caCertFile))
|
||||||
{
|
{
|
||||||
// Load the cert once at startup instead of on every connection.
|
// Load the cert once at startup instead of on every connection.
|
||||||
X509Certificate2 rootCA = new(caCertFile);
|
X509Certificate2Collection rootCACollection = [];
|
||||||
|
rootCACollection.ImportFromPemFile(caCertFile);
|
||||||
|
|
||||||
// This is a custom validator that obeys the set SslPolicyErrors, while also using the CA cert specified in the query string.
|
// This is a custom validator that obeys the set SslPolicyErrors, while also using the CA cert specified in the query string.
|
||||||
factory.Ssl.CertificateValidationCallback = (
|
factory.Ssl.CertificateValidationCallback = (
|
||||||
@ -144,7 +145,7 @@ public static class RabbitMqModule
|
|||||||
);
|
);
|
||||||
chain.ChainPolicy.CustomTrustStore.Clear();
|
chain.ChainPolicy.CustomTrustStore.Clear();
|
||||||
chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
|
chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
|
||||||
chain.ChainPolicy.CustomTrustStore.Add(rootCA);
|
chain.ChainPolicy.CustomTrustStore.AddRange(rootCACollection);
|
||||||
|
|
||||||
return chain.Build(new X509Certificate2(certificate));
|
return chain.Build(new X509Certificate2(certificate));
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user