You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.495
Former-commit-id: 7ac3d9a0512daf5dbdfccee163b153a77fda675c
This commit is contained in:
parent
702a3ab1af
commit
af08d800c3
@@ -150,7 +150,7 @@ namespace Mono.Btls
|
||||
using (var nativeChain = MonoBtlsProvider.GetNativeChain (certificates))
|
||||
using (var param = GetVerifyParam (targetHost, serverMode))
|
||||
using (var storeCtx = new MonoBtlsX509StoreCtx ()) {
|
||||
SetupCertificateStore (store);
|
||||
SetupCertificateStore (store, validator.Settings, serverMode);
|
||||
|
||||
storeCtx.Initialize (store, nativeChain);
|
||||
|
||||
@@ -201,19 +201,45 @@ namespace Mono.Btls
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetupCertificateStore (MonoBtlsX509Store store, MonoTlsSettings settings, bool server)
|
||||
{
|
||||
AddTrustedRoots (store, settings, server);
|
||||
SetupCertificateStore (store);
|
||||
}
|
||||
|
||||
internal static void SetupCertificateStore (MonoBtlsX509Store store)
|
||||
{
|
||||
#if MONODROID
|
||||
store.SetDefaultPaths ();
|
||||
store.AddAndroidLookup ();
|
||||
#else
|
||||
AddUserStore (store);
|
||||
AddMachineStore (store);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !MONODROID
|
||||
static void AddUserStore (MonoBtlsX509Store store)
|
||||
{
|
||||
var userPath = MonoBtlsX509StoreManager.GetStorePath (MonoBtlsX509StoreType.UserTrustedRoots);
|
||||
if (Directory.Exists (userPath))
|
||||
store.AddDirectoryLookup (userPath, MonoBtlsX509FileType.PEM);
|
||||
}
|
||||
|
||||
static void AddMachineStore (MonoBtlsX509Store store)
|
||||
{
|
||||
var machinePath = MonoBtlsX509StoreManager.GetStorePath (MonoBtlsX509StoreType.MachineTrustedRoots);
|
||||
if (Directory.Exists (machinePath))
|
||||
store.AddDirectoryLookup (machinePath, MonoBtlsX509FileType.PEM);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void AddTrustedRoots (MonoBtlsX509Store store, MonoTlsSettings settings, bool server)
|
||||
{
|
||||
if (settings?.TrustAnchors == null)
|
||||
return;
|
||||
var trust = server ? MonoBtlsX509TrustKind.TRUST_CLIENT : MonoBtlsX509TrustKind.TRUST_SERVER;
|
||||
store.AddCollection (settings.TrustAnchors, trust);
|
||||
}
|
||||
|
||||
public static string GetSystemStoreLocation ()
|
||||
|
||||
Reference in New Issue
Block a user