diff options
Diffstat (limited to 'src/csharp/Grpc.Core/Internal/CredentialsSafeHandle.cs')
-rw-r--r-- | src/csharp/Grpc.Core/Internal/CredentialsSafeHandle.cs | 18 |
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() |