DHKeyGenerationParameters.cs 756 B

1234567891011121314151617181920212223242526272829303132333435
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. using Org.BouncyCastle.Security;
  4. namespace Org.BouncyCastle.Crypto.Parameters
  5. {
  6. public class DHKeyGenerationParameters
  7. : KeyGenerationParameters
  8. {
  9. private readonly DHParameters parameters;
  10. public DHKeyGenerationParameters(
  11. SecureRandom random,
  12. DHParameters parameters)
  13. : base(random, GetStrength(parameters))
  14. {
  15. this.parameters = parameters;
  16. }
  17. public DHParameters Parameters
  18. {
  19. get { return parameters; }
  20. }
  21. internal static int GetStrength(
  22. DHParameters parameters)
  23. {
  24. return parameters.L != 0 ? parameters.L : parameters.P.BitLength;
  25. }
  26. }
  27. }
  28. #endif