aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core/Internal/CredentialsSafeHandle.cs
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-07-26 12:37:53 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-07-26 12:37:53 -0700
commitdfc42da76011eec3270b3dbcc94748916e0aa5b2 (patch)
tree5e1a69afefaaee7457ed1fa5796d00c06957757e /src/csharp/Grpc.Core/Internal/CredentialsSafeHandle.cs
parentb256faa353159c0b6f3477777bed75b4f9de3e16 (diff)
parent5c575dd6e4b01cd68cca5d1917b58023dcf4ca0f (diff)
Merge github.com:grpc/grpc into sometimes-its-good-just-to-check-in-with-each-other
Conflicts: src/core/iomgr/tcp_server_windows.c
Diffstat (limited to 'src/csharp/Grpc.Core/Internal/CredentialsSafeHandle.cs')
-rw-r--r--src/csharp/Grpc.Core/Internal/CredentialsSafeHandle.cs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/csharp/Grpc.Core/Internal/CredentialsSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CredentialsSafeHandle.cs
index f361199068..8b4fa85e5d 100644
--- a/src/csharp/Grpc.Core/Internal/CredentialsSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/CredentialsSafeHandle.cs
@@ -50,9 +50,23 @@ namespace Grpc.Core.Internal
{
}
- public static CredentialsSafeHandle CreateSslCredentials(string pemRootCerts)
+ public static CredentialsSafeHandle CreateNullCredentials()
{
- return grpcsharp_ssl_credentials_create(pemRootCerts, null, null);
+ var creds = new CredentialsSafeHandle();
+ creds.SetHandle(IntPtr.Zero);
+ return creds;
+ }
+
+ public static CredentialsSafeHandle CreateSslCredentials(string pemRootCerts, KeyCertificatePair keyCertPair)
+ {
+ if (keyCertPair != null)
+ {
+ return grpcsharp_ssl_credentials_create(pemRootCerts, keyCertPair.CertificateChain, keyCertPair.PrivateKey);
+ }
+ else
+ {
+ return grpcsharp_ssl_credentials_create(pemRootCerts, null, null);
+ }
}
protected override bool ReleaseHandle()