NaccacheSternPrivateKeyParameters.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.Collections.Generic;
  5. using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
  6. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
  7. {
  8. /**
  9. * Private key parameters for NaccacheStern cipher. For details on this cipher,
  10. * please see
  11. *
  12. * http://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf
  13. */
  14. public class NaccacheSternPrivateKeyParameters : NaccacheSternKeyParameters
  15. {
  16. private readonly BigInteger phiN;
  17. private readonly IList<BigInteger> smallPrimes;
  18. /**
  19. * Constructs a NaccacheSternPrivateKey
  20. *
  21. * @param g
  22. * the public enryption parameter g
  23. * @param n
  24. * the public modulus n = p*q
  25. * @param lowerSigmaBound
  26. * the public lower sigma bound up to which data can be encrypted
  27. * @param smallPrimes
  28. * the small primes, of which sigma is constructed in the right
  29. * order
  30. * @param phi_n
  31. * the private modulus phi(n) = (p-1)(q-1)
  32. */
  33. public NaccacheSternPrivateKeyParameters(
  34. BigInteger g,
  35. BigInteger n,
  36. int lowerSigmaBound,
  37. IList<BigInteger> smallPrimes,
  38. BigInteger phiN)
  39. : base(true, g, n, lowerSigmaBound)
  40. {
  41. this.smallPrimes = smallPrimes;
  42. this.phiN = phiN;
  43. }
  44. public BigInteger PhiN
  45. {
  46. get { return phiN; }
  47. }
  48. public IList<BigInteger> SmallPrimesList
  49. {
  50. get { return smallPrimes; }
  51. }
  52. }
  53. }
  54. #pragma warning restore
  55. #endif