TSPValidationException.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.Runtime.Serialization;
  5. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Tsp
  6. {
  7. /**
  8. * Exception thrown if a TSP request or response fails to validate.
  9. * <p>
  10. * If a failure code is associated with the exception it can be retrieved using
  11. * the getFailureCode() method.</p>
  12. */
  13. [Serializable]
  14. public class TspValidationException
  15. : TspException
  16. {
  17. protected readonly int m_failureCode;
  18. public TspValidationException(string message)
  19. : this(message, -1)
  20. {
  21. }
  22. public TspValidationException(string message, int failureCode)
  23. : base(message)
  24. {
  25. m_failureCode = failureCode;
  26. }
  27. protected TspValidationException(SerializationInfo info, StreamingContext context)
  28. : base(info, context)
  29. {
  30. m_failureCode = info.GetInt32("failureCode");
  31. }
  32. public override void GetObjectData(SerializationInfo info, StreamingContext context)
  33. {
  34. base.GetObjectData(info, context);
  35. info.AddValue("failureCode", m_failureCode);
  36. }
  37. /// <returns>The failure code associated with this exception, if one is set.</returns>
  38. public int FailureCode
  39. {
  40. get { return m_failureCode; }
  41. }
  42. }
  43. }
  44. #pragma warning restore
  45. #endif