Index: third_party/grpc/src/csharp/Grpc.Core/KeyCertificatePair.cs |
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs b/third_party/grpc/src/csharp/Grpc.Core/KeyCertificatePair.cs |
similarity index 60% |
copy from third_party/protobuf/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs |
copy to third_party/grpc/src/csharp/Grpc.Core/KeyCertificatePair.cs |
index f5570fc40a24f9e91017280b4f6389607be6e1a7..0fb6817986f8390a20ab4c363ef2e0baa8d13e69 100644 |
--- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/DescriptorUtil.cs |
+++ b/third_party/grpc/src/csharp/Grpc.Core/KeyCertificatePair.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-2016, 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,37 +28,56 @@ |
// 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 |
+using System; |
using System.Collections.Generic; |
-using System.Collections.ObjectModel; |
-namespace Google.Protobuf.Reflection |
+using Grpc.Core.Internal; |
+using Grpc.Core.Utils; |
+ |
+namespace Grpc.Core |
{ |
/// <summary> |
- /// Internal class containing utility methods when working with descriptors. |
+ /// Key certificate pair (in PEM encoding). |
/// </summary> |
- internal static class DescriptorUtil |
+ public sealed class KeyCertificatePair |
{ |
+ readonly string certificateChain; |
+ readonly string privateKey; |
+ |
/// <summary> |
- /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert |
- /// arrays. |
+ /// Creates a new certificate chain - private key pair. |
/// </summary> |
- internal delegate TOutput IndexedConverter<TInput, TOutput>(TInput element, int index); |
+ /// <param name="certificateChain">PEM encoded certificate chain.</param> |
+ /// <param name="privateKey">PEM encoded private key.</param> |
+ public KeyCertificatePair(string certificateChain, string privateKey) |
+ { |
+ this.certificateChain = GrpcPreconditions.CheckNotNull(certificateChain, "certificateChain"); |
+ this.privateKey = GrpcPreconditions.CheckNotNull(privateKey, "privateKey"); |
+ } |
+ |
+ /// <summary> |
+ /// PEM encoded certificate chain. |
+ /// </summary> |
+ public string CertificateChain |
+ { |
+ get |
+ { |
+ return certificateChain; |
+ } |
+ } |
/// <summary> |
- /// Converts the given array into a read-only list, applying the specified conversion to |
- /// each input element. |
+ /// PEM encoded private key. |
/// </summary> |
- internal static IList<TOutput> ConvertAndMakeReadOnly<TInput, TOutput> |
- (IList<TInput> input, IndexedConverter<TInput, TOutput> converter) |
+ public string PrivateKey |
{ |
- TOutput[] array = new TOutput[input.Count]; |
- for (int i = 0; i < array.Length; i++) |
+ get |
{ |
- array[i] = converter(input[i], i); |
+ return privateKey; |
} |
- return new ReadOnlyCollection<TOutput>(array); |
} |
} |
-} |
+} |