KeyCertificatePair.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #region Copyright notice and license
  2. // Copyright 2015 gRPC authors.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. #endregion
  16. using System;
  17. using System.Collections.Generic;
  18. using Grpc.Core.Internal;
  19. using Grpc.Core.Utils;
  20. namespace Grpc.Core
  21. {
  22. /// <summary>
  23. /// Key certificate pair (in PEM encoding).
  24. /// </summary>
  25. public sealed class KeyCertificatePair
  26. {
  27. readonly string certificateChain;
  28. readonly string privateKey;
  29. /// <summary>
  30. /// Creates a new certificate chain - private key pair.
  31. /// </summary>
  32. /// <param name="certificateChain">PEM encoded certificate chain.</param>
  33. /// <param name="privateKey">PEM encoded private key.</param>
  34. public KeyCertificatePair(string certificateChain, string privateKey)
  35. {
  36. this.certificateChain = GrpcPreconditions.CheckNotNull(certificateChain, "certificateChain");
  37. this.privateKey = GrpcPreconditions.CheckNotNull(privateKey, "privateKey");
  38. }
  39. /// <summary>
  40. /// PEM encoded certificate chain.
  41. /// </summary>
  42. public string CertificateChain
  43. {
  44. get
  45. {
  46. return certificateChain;
  47. }
  48. }
  49. /// <summary>
  50. /// PEM encoded private key.
  51. /// </summary>
  52. public string PrivateKey
  53. {
  54. get
  55. {
  56. return privateKey;
  57. }
  58. }
  59. }
  60. }