Commit 087e450b authored by Billy Cahill's avatar Billy Cahill

Adding an environ var (SERedis_ClientCertStorageFlags) for configuring which cert store to check.

parent 5fc9cc76
...@@ -624,9 +624,17 @@ static LocalCertificateSelectionCallback GetAmbientCertificateCallback() ...@@ -624,9 +624,17 @@ static LocalCertificateSelectionCallback GetAmbientCertificateCallback()
{ {
var pfxPath = Environment.GetEnvironmentVariable("SERedis_ClientCertPfxPath"); var pfxPath = Environment.GetEnvironmentVariable("SERedis_ClientCertPfxPath");
var pfxPassword = Environment.GetEnvironmentVariable("SERedis_ClientCertPassword"); var pfxPassword = Environment.GetEnvironmentVariable("SERedis_ClientCertPassword");
var pfxStorageFlags = Environment.GetEnvironmentVariable("SERedis_ClientCertStorageFlags");
X509KeyStorageFlags? flags = null;
if (!string.IsNullOrEmpty(pfxStorageFlags))
{
flags = Enum.Parse(typeof(X509KeyStorageFlags), pfxStorageFlags) as X509KeyStorageFlags?;
}
if (!string.IsNullOrEmpty(pfxPath) && File.Exists(pfxPath)) if (!string.IsNullOrEmpty(pfxPath) && File.Exists(pfxPath))
{ {
return delegate { return new X509Certificate2(pfxPath, pfxPassword ?? ""); }; return delegate { return new X509Certificate2(pfxPath, pfxPassword ?? "", flags ?? X509KeyStorageFlags.DefaultKeySet); };
} }
} catch } catch
{ } { }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment