cert_validate_message.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_SSL_CERT_VALIDATE_MESSAGE_H
10 #define SQUID_SSL_CERT_VALIDATE_MESSAGE_H
11 
12 #include "base/RefCount.h"
13 #include "helper/ResultCode.h"
14 #include "ssl/crtd_message.h"
15 #include "ssl/support.h"
16 
17 #include <vector>
18 
19 namespace Ssl
20 {
21 
27 {
28 public:
31  std::string domainName;
32 };
33 
39 {
40 public:
42 
47  class RecvdError
48  {
49  public:
50  RecvdError(): id(0), error_no(SSL_ERROR_NONE), cert(NULL), error_depth(-1) {}
51  RecvdError(const RecvdError &);
52  RecvdError & operator =(const RecvdError &);
53  void setCert(X509 *);
54  int id;
56  std::string error_reason;
57  Security::CertPointer cert;
59  };
60 
61  typedef std::vector<RecvdError> RecvdErrors;
62  explicit CertValidationResponse(const Security::SessionPointer &aSession) : ssl(aSession) {}
65  RecvdError &getError(int errorId);
69 };
70 
78 {
79 private:
84  class CertItem
85  {
86  public:
87  std::string name;
88  Security::CertPointer cert;
90  CertItem(const CertItem &);
91  CertItem & operator =(const CertItem &);
92  void setCert(X509 *);
93  };
94 
95 public:
97 
100  void composeRequest(CertValidationRequest const &vcert);
101 
103  bool parseResponse(CertValidationResponse &resp, std::string &error);
104 
106  X509 *getCertByName(std::vector<CertItem> const &, std::string const & name);
107 
109  static const std::string code_cert_validate;
111  static const std::string param_domain;
113  static const std::string param_cert;
115  static const std::string param_error_name;
117  static const std::string param_error_reason;
119  static const std::string param_error_cert;
121  static const std::string param_error_depth;
123  static const std::string param_proto_version;
125  static const std::string param_cipher;
126 };
127 
128 }//namespace Ssl
129 
130 #endif // SQUID_SSL_CERT_VALIDATE_MESSAGE_H
131 
Helper::ResultCode resultCode
The helper result code.
RecvdErrors errors
The list of parsed errors.
static const std::string param_error_reason
Parameter name for passing the error reason.
static const std::string code_cert_validate
String code for "cert_validate" messages.
Security::ErrorCode error_no
The OpenSSL error code.
void composeRequest(CertValidationRequest const &vcert)
ResultCode
enumeration value for the helper response 'result' field.
Definition: ResultCode.h:16
void error(char *format,...)
static const std::string param_error_depth
Parameter name for passing the error depth.
static const std::string param_cipher
Parameter name for SSL cipher.
void setCert(X509 *)
Sets cert to the given certificate.
static const std::string param_proto_version
Parameter name for SSL version.
static const std::string param_error_name
Parameter name for passing the major SSL error.
Security::SessionPointer ssl
Security::CertPointer cert
A pointer to certificate.
CertValidationResponse(const Security::SessionPointer &aSession)
X509 * getCertByName(std::vector< CertItem > const &, std::string const &name)
Search a CertItems list for the certificate with ID "name".
int ErrorCode
Squid defined error code (<0), an error code returned by X.509 API, or SSL_ERROR_NONE.
Definition: forward.h:116
std::string error_reason
A string describing the error.
RecvdError & operator=(const RecvdError &)
Security::CertErrors * errors
The list of errors detected.
std::string domainName
The server name.
std::vector< RecvdError > RecvdErrors
Security::SessionPointer ssl
static const std::string param_cert
Parameter name for passing SSL certificates.
CertItem & operator=(const CertItem &)
static const std::string param_domain
Parameter name for passing intended domain name.
CertValidationMsg(MessageKind kind)
std::string name
The certificate Id to use.
RefCount< CertValidationResponse > Pointer
void setCert(X509 *)
Sets cert to the given certificate.
static const std::string param_error_cert
Parameter name for passing the error cert ID.
Security::CertPointer cert
The broken certificate.
#define NULL
Definition: types.h:166
RecvdError & getError(int errorId)
bool parseResponse(CertValidationResponse &resp, std::string &error)
Parse a response message and fill the resp object with parsed informations.
std::shared_ptr< SSL > SessionPointer
Definition: Session.h:41

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors