AsymmetricCipherKeyPair.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto
  5. {
  6. /**
  7. * a holding class for public/private parameter pairs.
  8. */
  9. public class AsymmetricCipherKeyPair
  10. {
  11. private readonly AsymmetricKeyParameter publicParameter;
  12. private readonly AsymmetricKeyParameter privateParameter;
  13. /**
  14. * basic constructor.
  15. *
  16. * @param publicParam a public key parameters object.
  17. * @param privateParam the corresponding private key parameters.
  18. */
  19. public AsymmetricCipherKeyPair(
  20. AsymmetricKeyParameter publicParameter,
  21. AsymmetricKeyParameter privateParameter)
  22. {
  23. if (publicParameter.IsPrivate)
  24. throw new ArgumentException("Expected a public key", "publicParameter");
  25. if (!privateParameter.IsPrivate)
  26. throw new ArgumentException("Expected a private key", "privateParameter");
  27. this.publicParameter = publicParameter;
  28. this.privateParameter = privateParameter;
  29. }
  30. /**
  31. * return the public key parameters.
  32. *
  33. * @return the public key parameters.
  34. */
  35. public AsymmetricKeyParameter Public
  36. {
  37. get { return publicParameter; }
  38. }
  39. /**
  40. * return the private key parameters.
  41. *
  42. * @return the private key parameters.
  43. */
  44. public AsymmetricKeyParameter Private
  45. {
  46. get { return privateParameter; }
  47. }
  48. }
  49. }
  50. #pragma warning restore
  51. #endif