GOST3410PublicKeyParameters.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
  7. {
  8. public class Gost3410PublicKeyParameters
  9. : Gost3410KeyParameters
  10. {
  11. private readonly BigInteger y;
  12. public Gost3410PublicKeyParameters(
  13. BigInteger y,
  14. Gost3410Parameters parameters)
  15. : base(false, parameters)
  16. {
  17. if (y.SignValue < 1 || y.CompareTo(Parameters.P) >= 0)
  18. throw new ArgumentException("Invalid y for GOST3410 public key", "y");
  19. this.y = y;
  20. }
  21. public Gost3410PublicKeyParameters(
  22. BigInteger y,
  23. DerObjectIdentifier publicKeyParamSet)
  24. : base(false, publicKeyParamSet)
  25. {
  26. if (y.SignValue < 1 || y.CompareTo(Parameters.P) >= 0)
  27. throw new ArgumentException("Invalid y for GOST3410 public key", "y");
  28. this.y = y;
  29. }
  30. public BigInteger Y
  31. {
  32. get { return y; }
  33. }
  34. }
  35. }
  36. #pragma warning restore
  37. #endif