TlsServer.cs 4.0 KB

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