NaccacheSternPrivateKeyParameters.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.Collections;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
  6. namespace BestHTTP.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 smallPrimes;
  18. #if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
  19. [Obsolete]
  20. public NaccacheSternPrivateKeyParameters(
  21. BigInteger g,
  22. BigInteger n,
  23. int lowerSigmaBound,
  24. ArrayList smallPrimes,
  25. BigInteger phiN)
  26. : base(true, g, n, lowerSigmaBound)
  27. {
  28. this.smallPrimes = smallPrimes;
  29. this.phiN = phiN;
  30. }
  31. #endif
  32. /**
  33. * Constructs a NaccacheSternPrivateKey
  34. *
  35. * @param g
  36. * the public enryption parameter g
  37. * @param n
  38. * the public modulus n = p*q
  39. * @param lowerSigmaBound
  40. * the public lower sigma bound up to which data can be encrypted
  41. * @param smallPrimes
  42. * the small primes, of which sigma is constructed in the right
  43. * order
  44. * @param phi_n
  45. * the private modulus phi(n) = (p-1)(q-1)
  46. */
  47. public NaccacheSternPrivateKeyParameters(
  48. BigInteger g,
  49. BigInteger n,
  50. int lowerSigmaBound,
  51. IList smallPrimes,
  52. BigInteger phiN)
  53. : base(true, g, n, lowerSigmaBound)
  54. {
  55. this.smallPrimes = smallPrimes;
  56. this.phiN = phiN;
  57. }
  58. public BigInteger PhiN
  59. {
  60. get { return phiN; }
  61. }
  62. #if !(SILVERLIGHT || PORTABLE || NETFX_CORE)
  63. public ArrayList SmallPrimes
  64. {
  65. get { return new ArrayList(smallPrimes); }
  66. }
  67. #endif
  68. public IList SmallPrimesList
  69. {
  70. get { return smallPrimes; }
  71. }
  72. }
  73. }
  74. #pragma warning restore
  75. #endif