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
...@@ -616,21 +616,29 @@ internal int GetAvailableInboundBytes(out int activeReaders) ...@@ -616,21 +616,29 @@ internal int GetAvailableInboundBytes(out int activeReaders)
{ {
activeReaders = Interlocked.CompareExchange(ref haveReader, 0, 0); activeReaders = Interlocked.CompareExchange(ref haveReader, 0, 0);
return this.socketToken.Available; return this.socketToken.Available;
} }
static LocalCertificateSelectionCallback GetAmbientCertificateCallback() static LocalCertificateSelectionCallback GetAmbientCertificateCallback()
{ {
try try
{ {
var pfxPath = Environment.GetEnvironmentVariable("SERedis_ClientCertPfxPath"); var pfxPath = Environment.GetEnvironmentVariable("SERedis_ClientCertPfxPath");
var pfxPassword = Environment.GetEnvironmentVariable("SERedis_ClientCertPassword"); var pfxPassword = Environment.GetEnvironmentVariable("SERedis_ClientCertPassword");
if (!string.IsNullOrEmpty(pfxPath) && File.Exists(pfxPath)) var pfxStorageFlags = Environment.GetEnvironmentVariable("SERedis_ClientCertStorageFlags");
{
return delegate { return new X509Certificate2(pfxPath, pfxPassword ?? ""); }; X509KeyStorageFlags? flags = null;
} if (!string.IsNullOrEmpty(pfxStorageFlags))
} catch {
{ } flags = Enum.Parse(typeof(X509KeyStorageFlags), pfxStorageFlags) as X509KeyStorageFlags?;
return null; }
if (!string.IsNullOrEmpty(pfxPath) && File.Exists(pfxPath))
{
return delegate { return new X509Certificate2(pfxPath, pfxPassword ?? "", flags ?? X509KeyStorageFlags.DefaultKeySet); };
}
} catch
{ }
return null;
} }
SocketMode ISocketCallback.Connected(Stream stream) SocketMode ISocketCallback.Connected(Stream stream)
{ {
......
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