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
16
17#ifndef NetSSL_VerificationErrorArgs_INCLUDED
18#define NetSSL_VerificationErrorArgs_INCLUDED
19
20
21#include "Poco/Net/NetSSL.h"
22#include "Poco/Net/X509Certificate.h"
23
24
25namespace Poco {
26namespace Net {
27
28
29class NetSSL_API VerificationErrorArgs
30 /// A utility class for certificate error handling.
31{
32public:
33 VerificationErrorArgs(const X509Certificate& cert, int errDepth, int errNum, const std::string& errMsg);
34 /// Creates the VerificationErrorArgs. _ignoreError is per default set to false.
35
36 ~VerificationErrorArgs();
37 /// Destroys the VerificationErrorArgs.
38
39 const X509Certificate& certificate() const;
40 /// Returns the certificate that caused the error.
41
42 int errorDepth() const;
43 /// Returns the position of the certificate in the certificate chain.
44
45 int errorNumber() const;
46 /// Returns the id of the error
47
48 const std::string& errorMessage() const;
49 /// Returns the textual presentation of the errorNumber.
50
51 void setIgnoreError(bool ignoreError);
52 /// setIgnoreError to true, if a verification error is judged non-fatal by the user.
53
54 bool getIgnoreError() const;
55 /// returns the value of _ignoreError
56
57private:
58 X509Certificate _cert;
59 int _errorDepth;
60 int _errorNumber;
61 std::string _errorMessage; /// Textual representation of the _errorNumber
62 bool _ignoreError;
63};
64
65
66//
67// inlines
68//
69inline const X509Certificate& VerificationErrorArgs::certificate() const
70{
71 return _cert;
72}
73
74
75inline int VerificationErrorArgs::errorDepth() const
76{
77 return _errorDepth;
78}
79
80
81inline int VerificationErrorArgs::errorNumber() const
82{
83 return _errorNumber;
84}
85
86
87inline const std::string& VerificationErrorArgs::errorMessage() const
88{
89 return _errorMessage;
90}
91
92
93inline void VerificationErrorArgs::setIgnoreError(bool ignoreError)
94{
95 _ignoreError = ignoreError;
96}
97
98
99inline bool VerificationErrorArgs::getIgnoreError() const
100{
101 return _ignoreError;
102}
103
104
105} } // namespace Poco::Net
106
107
108#endif // NetSSL_VerificationErrorArgs_INCLUDED
109