AsymmetricCipherKeyPair.cs 1.5 KB

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