TlsServer.cs 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.Collections;
  5. using System.IO;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls
  7. {
  8. public interface TlsServer
  9. : TlsPeer
  10. {
  11. void Init(TlsServerContext context);
  12. /// <exception cref="IOException"></exception>
  13. void NotifyClientVersion(ProtocolVersion clientVersion);
  14. /// <exception cref="IOException"></exception>
  15. void NotifyFallback(bool isFallback);
  16. /// <exception cref="IOException"></exception>
  17. void NotifyOfferedCipherSuites(int[] offeredCipherSuites);
  18. /// <exception cref="IOException"></exception>
  19. void NotifyOfferedCompressionMethods(byte[] offeredCompressionMethods);
  20. /// <param name="clientExtensions">A <see cref="IDictionary"/> (Int32 -> byte[]). Will never be null.</param>
  21. /// <exception cref="IOException"></exception>
  22. void ProcessClientExtensions(IDictionary clientExtensions);
  23. /// <exception cref="IOException"></exception>
  24. ProtocolVersion GetServerVersion();
  25. /// <exception cref="IOException"></exception>
  26. int GetSelectedCipherSuite();
  27. /// <exception cref="IOException"></exception>
  28. byte GetSelectedCompressionMethod();
  29. /// <summary>
  30. /// Get the (optional) table of server extensions to be included in (extended) server hello.
  31. /// </summary>
  32. /// <returns>
  33. /// A <see cref="IDictionary"/> (Int32 -> byte[]). May be null.
  34. /// </returns>
  35. /// <exception cref="IOException"></exception>
  36. IDictionary GetServerExtensions();
  37. /// <returns>
  38. /// A <see cref="IList"/> (<see cref="SupplementalDataEntry"/>). May be null.
  39. /// </returns>
  40. /// <exception cref="IOException"></exception>
  41. IList GetServerSupplementalData();
  42. /// <exception cref="IOException"></exception>
  43. TlsCredentials GetCredentials();
  44. /// <remarks>
  45. /// This method will be called (only) if the server included an extension of type
  46. /// "status_request" with empty "extension_data" in the extended server hello. See <i>RFC 3546
  47. /// 3.6. Certificate Status Request</i>. If a non-null <see cref="CertificateStatus"/> is returned, it
  48. /// is sent to the client as a handshake message of type "certificate_status".
  49. /// </remarks>
  50. /// <returns>A <see cref="CertificateStatus"/> to be sent to the client (or null for none).</returns>
  51. /// <exception cref="IOException"></exception>
  52. CertificateStatus GetCertificateStatus();
  53. /// <exception cref="IOException"></exception>
  54. TlsKeyExchange GetKeyExchange();
  55. /// <exception cref="IOException"></exception>
  56. CertificateRequest GetCertificateRequest();
  57. /// <param name="clientSupplementalData"><see cref="IList"/> (<see cref="SupplementalDataEntry"/>)</param>
  58. /// <exception cref="IOException"></exception>
  59. void ProcessClientSupplementalData(IList clientSupplementalData);
  60. /// <summary>
  61. /// Called by the protocol handler to report the client certificate, only if <c>GetCertificateRequest</c>
  62. /// returned non-null.
  63. /// </summary>
  64. /// <remarks>Note: this method is responsible for certificate verification and validation.</remarks>
  65. /// <param name="clientCertificate">the effective client certificate (may be an empty chain).</param>
  66. /// <exception cref="IOException"></exception>
  67. void NotifyClientCertificate(Certificate clientCertificate);
  68. /// <summary>RFC 5077 3.3. NewSessionTicket Handshake Message.</summary>
  69. /// <remarks>
  70. /// This method will be called (only) if a NewSessionTicket extension was sent by the server. See
  71. /// <i>RFC 5077 4. Recommended Ticket Construction</i> for recommended format and protection.
  72. /// </remarks>
  73. /// <returns>The <see cref="NewSessionTicket">ticket</see>)</returns>
  74. /// <exception cref="IOException"></exception>
  75. NewSessionTicket GetNewSessionTicket();
  76. }
  77. }
  78. #pragma warning restore
  79. #endif