VerificationErrorArgs.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // VerificationErrorArgs.h
  3. //
  4. // Library: NetSSL_OpenSSL
  5. // Package: SSLCore
  6. // Module: VerificationErrorArgs
  7. //
  8. // Definition of the VerificationErrorArgs class.
  9. //
  10. // Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH.
  11. // and Contributors.
  12. //
  13. // SPDX-License-Identifier: BSL-1.0
  14. //
  15. #ifndef NetSSL_VerificationErrorArgs_INCLUDED
  16. #define NetSSL_VerificationErrorArgs_INCLUDED
  17. #include "Poco/Net/NetSSL.h"
  18. #include "Poco/Net/X509Certificate.h"
  19. namespace Poco {
  20. namespace Net {
  21. class NetSSL_API VerificationErrorArgs
  22. /// A utility class for certificate error handling.
  23. {
  24. public:
  25. VerificationErrorArgs(const X509Certificate& cert, int errDepth, int errNum, const std::string& errMsg);
  26. /// Creates the VerificationErrorArgs. _ignoreError is per default set to false.
  27. ~VerificationErrorArgs();
  28. /// Destroys the VerificationErrorArgs.
  29. const X509Certificate& certificate() const;
  30. /// Returns the certificate that caused the error.
  31. int errorDepth() const;
  32. /// Returns the position of the certificate in the certificate chain.
  33. int errorNumber() const;
  34. /// Returns the id of the error
  35. const std::string& errorMessage() const;
  36. /// Returns the textual presentation of the errorNumber.
  37. void setIgnoreError(bool ignoreError);
  38. /// setIgnoreError to true, if a verification error is judged non-fatal by the user.
  39. bool getIgnoreError() const;
  40. /// returns the value of _ignoreError
  41. private:
  42. X509Certificate _cert;
  43. int _errorDepth;
  44. int _errorNumber;
  45. std::string _errorMessage; /// Textual representation of the _errorNumber
  46. bool _ignoreError;
  47. };
  48. //
  49. // inlines
  50. //
  51. inline const X509Certificate& VerificationErrorArgs::certificate() const
  52. {
  53. return _cert;
  54. }
  55. inline int VerificationErrorArgs::errorDepth() const
  56. {
  57. return _errorDepth;
  58. }
  59. inline int VerificationErrorArgs::errorNumber() const
  60. {
  61. return _errorNumber;
  62. }
  63. inline const std::string& VerificationErrorArgs::errorMessage() const
  64. {
  65. return _errorMessage;
  66. }
  67. inline void VerificationErrorArgs::setIgnoreError(bool ignoreError)
  68. {
  69. _ignoreError = ignoreError;
  70. }
  71. inline bool VerificationErrorArgs::getIgnoreError() const
  72. {
  73. return _ignoreError;
  74. }
  75. } } // namespace Poco::Net
  76. #endif // NetSSL_VerificationErrorArgs_INCLUDED