MqvPublicParameters.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. namespace Org.BouncyCastle.Crypto.Parameters
  4. {
  5. public class MqvPublicParameters
  6. : ICipherParameters
  7. {
  8. private readonly ECPublicKeyParameters staticPublicKey;
  9. private readonly ECPublicKeyParameters ephemeralPublicKey;
  10. public MqvPublicParameters(
  11. ECPublicKeyParameters staticPublicKey,
  12. ECPublicKeyParameters ephemeralPublicKey)
  13. {
  14. if (staticPublicKey == null)
  15. throw new ArgumentNullException("staticPublicKey");
  16. if (ephemeralPublicKey == null)
  17. throw new ArgumentNullException("ephemeralPublicKey");
  18. if (!staticPublicKey.Parameters.Equals(ephemeralPublicKey.Parameters))
  19. throw new ArgumentException("Static and ephemeral public keys have different domain parameters");
  20. this.staticPublicKey = staticPublicKey;
  21. this.ephemeralPublicKey = ephemeralPublicKey;
  22. }
  23. public virtual ECPublicKeyParameters StaticPublicKey
  24. {
  25. get { return staticPublicKey; }
  26. }
  27. public virtual ECPublicKeyParameters EphemeralPublicKey
  28. {
  29. get { return ephemeralPublicKey; }
  30. }
  31. }
  32. }
  33. #endif