GOST3410PrivateKeyParameters.cs 1016 B

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