TlsContext.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls
  7. {
  8. public interface TlsContext
  9. {
  10. IRandomGenerator NonceRandomGenerator { get; }
  11. SecureRandom SecureRandom { get; }
  12. SecurityParameters SecurityParameters { get; }
  13. bool IsServer { get; }
  14. ProtocolVersion ClientVersion { get; }
  15. ProtocolVersion ServerVersion { get; }
  16. /**
  17. * Used to get the resumable session, if any, used by this connection. Only available after the
  18. * handshake has successfully completed.
  19. *
  20. * @return A {@link TlsSession} representing the resumable session used by this connection, or
  21. * null if no resumable session available.
  22. * @see TlsPeer#NotifyHandshakeComplete()
  23. */
  24. TlsSession ResumableSession { get; }
  25. object UserObject { get; set; }
  26. /**
  27. * Export keying material according to RFC 5705: "Keying Material Exporters for TLS".
  28. *
  29. * @param asciiLabel indicates which application will use the exported keys.
  30. * @param context_value allows the application using the exporter to mix its own data with the TLS PRF for
  31. * the exporter output.
  32. * @param length the number of bytes to generate
  33. * @return a pseudorandom bit string of 'length' bytes generated from the master_secret.
  34. */
  35. byte[] ExportKeyingMaterial(string asciiLabel, byte[] context_value, int length);
  36. }
  37. }
  38. #pragma warning restore
  39. #endif