]>
Commit | Line | Data |
---|---|---|
a1f04d64 AR |
1 | /* |
2 | * $Id$ | |
3 | */ | |
4 | ||
5 | #ifndef SQUID_SSL_CERT_VALIDATE_MESSAGE_H | |
6 | #define SQUID_SSL_CERT_VALIDATE_MESSAGE_H | |
7 | ||
8 | #include "ssl/support.h" | |
9 | #include "ssl/crtd_message.h" | |
10 | #include <vector> | |
11 | ||
12 | namespace Ssl | |
13 | { | |
14 | ||
15 | ||
16 | class ValidateCertificate { | |
17 | public: | |
18 | STACK_OF(X509) *peerCerts; | |
19 | Errors *errors; | |
20 | std::string domainName; | |
21 | ValidateCertificate() : peerCerts(NULL), errors(NULL) {} | |
22 | }; | |
23 | ||
24 | class ValidateCertificateResponse { | |
25 | public: | |
26 | class ErrorItem{ | |
27 | public: | |
77dce8a5 | 28 | ErrorItem(): error_no(SSL_ERROR_NONE), cert(NULL) {} |
a1f04d64 AR |
29 | ErrorItem(const ErrorItem &); |
30 | ~ErrorItem(); | |
31 | ErrorItem & operator = (const ErrorItem &); | |
32 | void setCert(X509 *); | |
33 | void clear(); | |
34 | ssl_error_t error_no; | |
35 | std::string error_reason; | |
a1f04d64 AR |
36 | X509 *cert; |
37 | }; | |
38 | ||
39 | class CertItem { | |
40 | public: | |
41 | std::string name; | |
42 | X509 *cert; | |
43 | CertItem(): cert(NULL) {} | |
44 | CertItem(const CertItem &); | |
45 | CertItem & operator = (const CertItem &); | |
46 | ~CertItem(); | |
47 | void setCert(X509 *); | |
48 | }; | |
49 | ||
50 | std::vector<ErrorItem> errors; | |
51 | ValidateCertificateResponse() {} | |
52 | ~ValidateCertificateResponse() {/*Maybe needs to release Errors*/}; | |
53 | }; | |
54 | ||
55 | class CertValidateMessage: public CrtdMessage { | |
56 | public: | |
57 | CertValidateMessage(): CrtdMessage() {} | |
58 | void composeRequest(ValidateCertificate const &vcert); | |
77dce8a5 | 59 | bool parseResponse(ValidateCertificateResponse &resp, STACK_OF(X509) *peerCerts, std::string &error); |
a1f04d64 AR |
60 | |
61 | /// String code for "cert_validate" messages | |
62 | static const std::string code_cert_validate; | |
63 | /// Parameter name for passing intended domain name | |
64 | static const std::string param_domain; | |
65 | /// Parameter name for passing SSL errors | |
66 | static const std::string param_error; | |
67 | /// Parameter name for passing SSL certificates | |
68 | static const std::string param_cert; | |
69 | /// Parameter name for passing the major SSL error | |
70 | static const std::string param_error_name; | |
71 | /// Parameter name for passing the error reason | |
72 | static const std::string param_error_reason; | |
73 | /// Parameter name for passing the error cert ID | |
74 | static const std::string param_error_cert; | |
75 | }; | |
76 | ||
77 | }//namespace Ssl | |
78 | #endif // SQUID_SSL_CERT_VALIDATE_MESSAGE_H |