TlsFatalAlert.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls
  5. {
  6. public class TlsFatalAlert
  7. : TlsException
  8. {
  9. private static string GetMessage(short alertDescription, string detailMessage)
  10. {
  11. string msg = Tls.AlertDescription.GetText(alertDescription);
  12. if (null != detailMessage)
  13. {
  14. msg += "; " + detailMessage;
  15. }
  16. return msg;
  17. }
  18. protected readonly short m_alertDescription;
  19. public TlsFatalAlert(short alertDescription)
  20. : this(alertDescription, (string)null)
  21. {
  22. }
  23. public TlsFatalAlert(short alertDescription, string detailMessage)
  24. : this(alertDescription, detailMessage, null)
  25. {
  26. }
  27. public TlsFatalAlert(short alertDescription, Exception alertCause)
  28. : this(alertDescription, null, alertCause)
  29. {
  30. }
  31. public TlsFatalAlert(short alertDescription, string detailMessage, Exception alertCause)
  32. : base(GetMessage(alertDescription, detailMessage), alertCause)
  33. {
  34. this.m_alertDescription = alertDescription;
  35. }
  36. public virtual short AlertDescription
  37. {
  38. get { return m_alertDescription; }
  39. }
  40. }
  41. }
  42. #pragma warning restore
  43. #endif