Index: third_party/grpc/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs |
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs b/third_party/grpc/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs |
similarity index 59% |
copy from third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs |
copy to third_party/grpc/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs |
index e547d834986de8d80703504469e9c39b3d8ae93d..ce108d808b6860455249720b5a861249adb0af69 100644 |
--- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs |
+++ b/third_party/grpc/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs |
@@ -1,7 +1,7 @@ |
#region Copyright notice and license |
-// Protocol Buffers - Google's data interchange format |
-// Copyright 2008 Google Inc. All rights reserved. |
-// https://developers.google.com/protocol-buffers/ |
+ |
+// Copyright 2015, Google Inc. |
+// All rights reserved. |
// |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
@@ -28,41 +28,43 @@ |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ |
#endregion |
-namespace Google.Protobuf.Reflection |
+using System; |
+using System.Collections.Generic; |
+using System.Diagnostics; |
+using System.IO; |
+using System.Text.RegularExpressions; |
+using System.Threading.Tasks; |
+using Grpc.Core; |
+using Grpc.Core.Utils; |
+using NUnit.Framework; |
+ |
+namespace Grpc.IntegrationTesting |
{ |
/// <summary> |
- /// Represents a package in the symbol table. We use PackageDescriptors |
- /// just as placeholders so that someone cannot define, say, a message type |
- /// that has the same name as an existing package. |
+ /// SSL Credentials for testing. |
/// </summary> |
- internal sealed class PackageDescriptor : IDescriptor |
+ public static class TestCredentials |
{ |
- private readonly string name; |
- private readonly string fullName; |
- private readonly FileDescriptor file; |
- |
- internal PackageDescriptor(string name, string fullName, FileDescriptor file) |
- { |
- this.file = file; |
- this.fullName = fullName; |
- this.name = name; |
- } |
+ public const string DefaultHostOverride = "foo.test.google.fr"; |
- public string Name |
- { |
- get { return name; } |
- } |
+ public const string ClientCertAuthorityPath = "data/ca.pem"; |
+ public const string ServerCertChainPath = "data/server1.pem"; |
+ public const string ServerPrivateKeyPath = "data/server1.key"; |
- public string FullName |
+ public static SslCredentials CreateSslCredentials() |
{ |
- get { return fullName; } |
+ return new SslCredentials(File.ReadAllText(ClientCertAuthorityPath)); |
} |
- public FileDescriptor File |
+ public static SslServerCredentials CreateSslServerCredentials() |
{ |
- get { return file; } |
+ var keyCertPair = new KeyCertificatePair( |
+ File.ReadAllText(ServerCertChainPath), |
+ File.ReadAllText(ServerPrivateKeyPath)); |
+ return new SslServerCredentials(new[] { keyCertPair }); |
} |
} |
-} |
+} |