MaxFragmentLength.cs 623 B

123456789101112131415161718192021222324
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls
  5. {
  6. public abstract class MaxFragmentLength
  7. {
  8. /*
  9. * RFC 3546 3.2.
  10. */
  11. public const short pow2_9 = 1;
  12. public const short pow2_10 = 2;
  13. public const short pow2_11 = 3;
  14. public const short pow2_12 = 4;
  15. public static bool IsValid(short maxFragmentLength)
  16. {
  17. return maxFragmentLength >= pow2_9 && maxFragmentLength <= pow2_12;
  18. }
  19. }
  20. }
  21. #pragma warning restore
  22. #endif