#include <cert_validate_message.h>
Classes | |
class | CertItem |
Public Types | |
enum | ParseResult { OK , INCOMPLETE , ERROR } |
Parse result codes. More... | |
enum | MessageKind { REPLY , REQUEST } |
typedef std::map< std::string, std::string > | BodyParams |
Public Member Functions | |
CertValidationMsg (MessageKind kind) | |
void | composeRequest (CertValidationRequest const &vcert) |
bool | parseResponse (CertValidationResponse &resp) |
Parse a response message and fill the resp object with parsed information. More... | |
X509 * | getCertByName (std::vector< CertItem > const &, std::string const &name) |
Search a CertItems list for the certificate with ID "name". More... | |
ParseResult | parse (const char *buffer, size_t len) |
std::string const & | getBody () const |
Current body. If parsing is not finished the method returns incompleted body. More... | |
std::string const & | getCode () const |
Current response/request code. If parsing is not finished the method may return incompleted code. More... | |
void | setBody (std::string const &aBody) |
Set new body to encode. More... | |
void | setCode (std::string const &aCode) |
Set new request/reply code to compose. More... | |
std::string | compose () const |
void | clear () |
Reset the class. More... | |
void | parseBody (BodyParams &map, std::string &other_part) const |
void | composeBody (BodyParams const &map, std::string const &other_part) |
void | parseRequest (CertificateProperties &) |
orchestrates entire request parsing More... | |
void | composeRequest (Ssl::CertificateProperties const &) |
Static Public Attributes | |
static const std::string | code_cert_validate |
String code for "cert_validate" messages. More... | |
static const std::string | param_domain |
Parameter name for passing intended domain name. More... | |
static const std::string | param_cert |
Parameter name for passing SSL certificates. More... | |
static const std::string | param_error_name |
Parameter name for passing the major SSL error. More... | |
static const std::string | param_error_reason |
Parameter name for passing the error reason. More... | |
static const std::string | param_error_cert |
Parameter name for passing the error cert ID. More... | |
static const std::string | param_error_depth |
Parameter name for passing the error depth. More... | |
static const std::string | param_proto_version |
Parameter name for SSL version. More... | |
static const std::string | param_cipher |
Parameter name for SSL cipher. More... | |
static const std::string | code_new_certificate |
String code for "new_certificate" messages. More... | |
static const std::string | param_host |
Parameter name for passing hostname. More... | |
static const std::string | param_SetValidAfter |
Parameter name for passing SetValidAfter cert adaptation variable. More... | |
static const std::string | param_SetValidBefore |
Parameter name for passing SetValidBefore cert adaptation variable. More... | |
static const std::string | param_SetCommonName |
Parameter name for passing SetCommonName cert adaptation variable. More... | |
static const std::string | param_Sign |
Parameter name for passing signing algorithm. More... | |
static const std::string | param_SignHash |
The signing hash to use. More... | |
Protected Types | |
enum | ParseState { BEFORE_CODE , CODE , BEFORE_LENGTH , LENGTH , BEFORE_BODY , BODY , END } |
Protected Attributes | |
size_t | body_size |
The body size if exist or 0. More... | |
ParseState | state |
Parsing state. More... | |
std::string | body |
Current body. More... | |
std::string | code |
Current response/request code. More... | |
std::string | current_block |
Current block buffer. More... | |
Private Member Functions | |
void | tryParsingResponse (CertValidationResponse &) |
Detailed Description
This class is responsible for composing or parsing messages destined to or coming from a certificate validation helper. The messages format is:
response/request-code SP body-length SP [key=value ...] EOL
- Note
- EOL for this interface is character 0x01
Definition at line 80 of file cert_validate_message.h.
Member Typedef Documentation
◆ BodyParams
|
inherited |
Definition at line 27 of file crtd_message.h.
Member Enumeration Documentation
◆ MessageKind
|
inherited |
Enumerator | |
---|---|
REPLY | |
REQUEST |
Definition at line 34 of file crtd_message.h.
◆ ParseResult
|
inherited |
Enumerator | |
---|---|
OK | |
INCOMPLETE | |
ERROR |
Definition at line 29 of file crtd_message.h.
◆ ParseState
|
protectedinherited |
Enumerator | |
---|---|
BEFORE_CODE | |
CODE | |
BEFORE_LENGTH | |
LENGTH | |
BEFORE_BODY | |
BODY | |
END |
Definition at line 90 of file crtd_message.h.
Constructor & Destructor Documentation
◆ CertValidationMsg()
|
inline |
Definition at line 96 of file cert_validate_message.h.
Member Function Documentation
◆ clear()
|
inherited |
Definition at line 136 of file crtd_message.cc.
References code.
◆ compose()
|
inherited |
Compose current (request) code and body to string.
Definition at line 128 of file crtd_message.cc.
References code.
Referenced by ConnStateData::getSslContextStart(), processNewRequest(), Ssl::CertValidationHelper::Submit(), and Ssl::Helper::Submit().
◆ composeBody()
|
inherited |
Compose parameters given by map with their values and the other part given by other_part to body data. The constructed body will have the form:
param1=value1 param2=value2 The other multistring part of body.
Definition at line 168 of file crtd_message.cc.
◆ composeRequest() [1/2]
void Ssl::CertValidationMsg::composeRequest | ( | CertValidationRequest const & | vcert | ) |
Build a request message for the cert validation helper using information provided by vcert object
Definition at line 38 of file cert_validate_message.cc.
References Ssl::CrtdMessage::body, debugs, Ssl::CertValidationRequest::domainName, Ssl::CertValidationRequest::errors, Ssl::GetErrorName(), CbDataList< C >::next, param_cert, param_cipher, param_error_cert, param_error_name, Ssl::CrtdMessage::param_host, param_proto_version, Ssl::CertValidationRequest::ssl, STACK_OF(), and xitoa().
Referenced by Ssl::CertValidationHelper::Submit().
◆ composeRequest() [2/2]
|
inherited |
Definition at line 235 of file crtd_message.cc.
References Ssl::algSignEnd, Ssl::appendCertToMemory(), Ssl::certSignAlgorithm(), Ssl::CertificateProperties::commonName, Security::LockingPointer< T, UnLocker, Locker >::get(), Here, Ssl::CertificateProperties::mimicCert, Ssl::CrtdMessage::param_host, Ssl::CrtdMessage::param_SetCommonName, Ssl::CrtdMessage::param_SetValidAfter, Ssl::CrtdMessage::param_SetValidBefore, Ssl::CrtdMessage::param_Sign, Ssl::CrtdMessage::param_SignHash, Ssl::CertificateProperties::setCommonName, Ssl::CertificateProperties::setValidAfter, Ssl::CertificateProperties::setValidBefore, Ssl::CertificateProperties::signAlgorithm, Ssl::CertificateProperties::signHash, Ssl::CertificateProperties::signWithPkey, Ssl::CertificateProperties::signWithX509, and Ssl::writeCertAndPrivateKeyToMemory().
Referenced by ConnStateData::getSslContextStart().
◆ getBody()
|
inherited |
Definition at line 120 of file crtd_message.cc.
Referenced by ConnStateData::sslCrtdHandleReply(), and sslCrtvdHandleReplyWrapper().
◆ getCertByName()
X509 * Ssl::CertValidationMsg::getCertByName | ( | std::vector< CertItem > const & | certs, |
std::string const & | name | ||
) |
Definition at line 199 of file cert_validate_message.cc.
◆ getCode()
|
inherited |
◆ parse()
|
inherited |
Parse buffer of length len
- Return values
-
OK if parsing completes INCOMPLETE if more data required ERROR if there is an error.
Definition at line 23 of file crtd_message.cc.
References code, Comm::OK, xisalnum, xisalpha, xisdigit, and xisspace.
Referenced by main(), ConnStateData::sslCrtdHandleReply(), and sslCrtvdHandleReplyWrapper().
◆ parseBody()
|
inherited |
Parse body data which has the form:
param1=value1 param2=value2 The other multistring part of body.
The parameters of the body stored to map and the remaining part to other_part
Definition at line 145 of file crtd_message.cc.
◆ parseRequest()
|
inherited |
Definition at line 181 of file crtd_message.cc.
References Ssl::algSignEnd, Ssl::algSignTrusted, Ssl::certSignAlgorithmId(), Ssl::CertificateProperties::commonName, Here, Ssl::CertificateProperties::mimicCert, Ssl::CrtdMessage::param_host, Ssl::CrtdMessage::param_SetCommonName, Ssl::CrtdMessage::param_SetValidAfter, Ssl::CrtdMessage::param_SetValidBefore, Ssl::CrtdMessage::param_Sign, Ssl::CrtdMessage::param_SignHash, Ssl::readCertAndPrivateKeyFromMemory(), Ssl::ReadCertificate(), Ssl::ReadOnlyBioTiedTo(), Ssl::CertificateProperties::setCommonName, Ssl::CertificateProperties::setValidAfter, Ssl::CertificateProperties::setValidBefore, Ssl::CertificateProperties::signAlgorithm, Ssl::CertificateProperties::signHash, Ssl::CertificateProperties::signWithPkey, Ssl::CertificateProperties::signWithX509, SQUID_SSL_SIGN_HASH_IF_NONE, and ToSBuf().
Referenced by processNewRequest().
◆ parseResponse()
bool Ssl::CertValidationMsg::parseResponse | ( | CertValidationResponse & | resp | ) |
Definition at line 93 of file cert_validate_message.cc.
References CurrentException(), DBG_IMPORTANT, debugs, and Debug::Extra().
Referenced by sslCrtvdHandleReplyWrapper().
◆ setBody()
|
inherited |
Definition at line 124 of file crtd_message.cc.
Referenced by processNewRequest().
◆ setCode()
|
inherited |
Definition at line 126 of file crtd_message.cc.
References code.
Referenced by ConnStateData::getSslContextStart(), processNewRequest(), and Ssl::CertValidationHelper::Submit().
◆ tryParsingResponse()
|
private |
implements primary parseResponse() functionality until that method callers are ready to handle exceptions
Definition at line 109 of file cert_validate_message.cc.
References debugs, Ssl::CertValidationResponse::RecvdError::error_depth, Ssl::CertValidationResponse::RecvdError::error_no, Ssl::CertValidationResponse::RecvdError::error_reason, Ssl::CertValidationResponse::errors, get_error_id(), Ssl::CertValidationResponse::getError(), Ssl::GetErrorCode(), Here, Ssl::CertValidationMsg::CertItem::name, Ssl::ReadCertificate(), Ssl::ReadOnlyBioTiedTo(), Ssl::CertValidationResponse::RecvdError::setCert(), Ssl::CertValidationMsg::CertItem::setCert(), Ssl::CertValidationResponse::ssl, STACK_OF(), ToSBuf(), and xisspace.
Member Data Documentation
◆ body
|
protectedinherited |
Definition at line 101 of file crtd_message.h.
Referenced by composeRequest().
◆ body_size
|
protectedinherited |
Definition at line 99 of file crtd_message.h.
◆ code
|
protectedinherited |
Definition at line 102 of file crtd_message.h.
◆ code_cert_validate
|
static |
Definition at line 109 of file cert_validate_message.h.
Referenced by Ssl::CertValidationHelper::Submit().
◆ code_new_certificate
|
staticinherited |
Definition at line 76 of file crtd_message.h.
Referenced by ConnStateData::getSslContextStart(), main(), and usage().
◆ current_block
|
protectedinherited |
Definition at line 103 of file crtd_message.h.
◆ param_cert
|
static |
Definition at line 113 of file cert_validate_message.h.
Referenced by composeRequest().
◆ param_cipher
|
static |
Definition at line 125 of file cert_validate_message.h.
Referenced by composeRequest().
◆ param_domain
|
static |
Definition at line 111 of file cert_validate_message.h.
◆ param_error_cert
|
static |
Definition at line 119 of file cert_validate_message.h.
Referenced by composeRequest().
◆ param_error_depth
|
static |
Definition at line 121 of file cert_validate_message.h.
◆ param_error_name
|
static |
Definition at line 115 of file cert_validate_message.h.
Referenced by composeRequest().
◆ param_error_reason
|
static |
Definition at line 117 of file cert_validate_message.h.
◆ param_host
|
staticinherited |
Definition at line 78 of file crtd_message.h.
Referenced by composeRequest(), Ssl::CrtdMessage::composeRequest(), Ssl::CrtdMessage::parseRequest(), and usage().
◆ param_proto_version
|
static |
Definition at line 123 of file cert_validate_message.h.
Referenced by composeRequest().
◆ param_SetCommonName
|
staticinherited |
Definition at line 84 of file crtd_message.h.
Referenced by Ssl::CrtdMessage::composeRequest(), and Ssl::CrtdMessage::parseRequest().
◆ param_SetValidAfter
|
staticinherited |
Definition at line 80 of file crtd_message.h.
Referenced by Ssl::CrtdMessage::composeRequest(), and Ssl::CrtdMessage::parseRequest().
◆ param_SetValidBefore
|
staticinherited |
Definition at line 82 of file crtd_message.h.
Referenced by Ssl::CrtdMessage::composeRequest(), and Ssl::CrtdMessage::parseRequest().
◆ param_Sign
|
staticinherited |
Definition at line 86 of file crtd_message.h.
Referenced by Ssl::CrtdMessage::composeRequest(), and Ssl::CrtdMessage::parseRequest().
◆ param_SignHash
|
staticinherited |
Definition at line 88 of file crtd_message.h.
Referenced by Ssl::CrtdMessage::composeRequest(), and Ssl::CrtdMessage::parseRequest().
◆ state
|
protectedinherited |
Definition at line 100 of file crtd_message.h.
The documentation for this class was generated from the following files:
- src/ssl/cert_validate_message.h
- src/ssl/cert_validate_message.cc