TlsPeer.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. using System.IO;
  4. namespace Org.BouncyCastle.Crypto.Tls
  5. {
  6. public interface TlsPeer
  7. {
  8. /// <summary>
  9. /// draft-mathewson-no-gmtunixtime-00 2. "If existing users of a TLS implementation may rely on
  10. /// gmt_unix_time containing the current time, we recommend that implementors MAY provide the
  11. /// ability to set gmt_unix_time as an option only, off by default."
  12. /// </summary>
  13. /// <returns>
  14. /// <code>true</code> if the current time should be used in the gmt_unix_time field of
  15. /// Random, or <code>false</code> if gmt_unix_time should contain a cryptographically
  16. /// random value.
  17. /// </returns>
  18. bool ShouldUseGmtUnixTime();
  19. /// <summary>
  20. /// Report whether the server supports secure renegotiation
  21. /// </summary>
  22. /// <remarks>
  23. /// The protocol handler automatically processes the relevant extensions
  24. /// </remarks>
  25. /// <param name="secureRenegotiation">
  26. /// A <see cref="System.Boolean"/>, true if the server supports secure renegotiation
  27. /// </param>
  28. /// <exception cref="IOException"></exception>
  29. void NotifySecureRenegotiation(bool secureRenegotiation);
  30. /// <summary>
  31. /// Return an implementation of <see cref="TlsCompression"/> to handle record compression.
  32. /// </summary>
  33. /// <returns>A <see cref="TlsCompression"/></returns>
  34. /// <exception cref="IOException"/>
  35. TlsCompression GetCompression();
  36. /// <summary>
  37. /// Return an implementation of <see cref="TlsCipher"/> to use for encryption/decryption.
  38. /// </summary>
  39. /// <returns>A <see cref="TlsCipher"/></returns>
  40. /// <exception cref="IOException"/>
  41. TlsCipher GetCipher();
  42. /// <summary>This method will be called when an alert is raised by the protocol.</summary>
  43. /// <param name="alertLevel"><see cref="AlertLevel"/></param>
  44. /// <param name="alertDescription"><see cref="AlertDescription"/></param>
  45. /// <param name="message">A human-readable message explaining what caused this alert. May be null.</param>
  46. /// <param name="cause">The <c>Exception</c> that caused this alert to be raised. May be null.</param>
  47. void NotifyAlertRaised(byte alertLevel, byte alertDescription, string message, Exception cause);
  48. /// <summary>This method will be called when an alert is received from the remote peer.</summary>
  49. /// <param name="alertLevel"><see cref="AlertLevel"/></param>
  50. /// <param name="alertDescription"><see cref="AlertDescription"/></param>
  51. void NotifyAlertReceived(byte alertLevel, byte alertDescription);
  52. /// <summary>Notifies the peer that the handshake has been successfully completed.</summary>
  53. /// <exception cref="IOException"></exception>
  54. void NotifyHandshakeComplete();
  55. }
  56. }
  57. #endif