TlsContext.cs 1.6 KB

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