AbstractTlsPeer.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.IO;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls
  6. {
  7. public abstract class AbstractTlsPeer
  8. : TlsPeer
  9. {
  10. public virtual bool RequiresExtendedMasterSecret()
  11. {
  12. return false;
  13. }
  14. public virtual bool ShouldUseGmtUnixTime()
  15. {
  16. /*
  17. * draft-mathewson-no-gmtunixtime-00 2. For the reasons we discuss above, we recommend that
  18. * TLS implementors MUST by default set the entire value the ClientHello.Random and
  19. * ServerHello.Random fields, including gmt_unix_time, to a cryptographically random
  20. * sequence.
  21. */
  22. return false;
  23. }
  24. public virtual void NotifySecureRenegotiation(bool secureRenegotiation)
  25. {
  26. if (!secureRenegotiation)
  27. {
  28. /*
  29. * RFC 5746 3.4/3.6. In this case, some clients/servers may want to terminate the handshake instead
  30. * of continuing; see Section 4.1/4.3 for discussion.
  31. */
  32. throw new TlsFatalAlert(AlertDescription.handshake_failure);
  33. }
  34. }
  35. public abstract TlsCompression GetCompression();
  36. public abstract TlsCipher GetCipher();
  37. public virtual void NotifyAlertRaised(byte alertLevel, byte alertDescription, string message, Exception cause)
  38. {
  39. }
  40. public virtual void NotifyAlertReceived(byte alertLevel, byte alertDescription)
  41. {
  42. }
  43. public virtual void NotifyHandshakeComplete()
  44. {
  45. }
  46. }
  47. }
  48. #pragma warning restore
  49. #endif