crtd_message.cc
Go to the documentation of this file.
96 size_t body_len = (static_cast<size_t>(buffer + len - current_pos) >= body_size - current_block.length())
168void Ssl::CrtdMessage::composeBody(CrtdMessage::BodyParams const & map, std::string const & other_part)
210 if ((certProperties.signAlgorithm = Ssl::certSignAlgorithmId(i->second.c_str())) == Ssl::algSignEnd) {
222 if (!Ssl::readCertAndPrivateKeyFromMemory(certProperties.signWithX509, certProperties.signWithPkey, certs_part.c_str())) {
246 body += "\n" + Ssl::CrtdMessage::param_Sign + "=" + certSignAlgorithm(certProperties.signAlgorithm);
251 if (!Ssl::writeCertAndPrivateKeyToMemory(certProperties.signWithX509, certProperties.signWithPkey, certsPart))
262const std::string Ssl::CrtdMessage::param_SetValidAfter(Ssl::CertAdaptAlgorithmStr[algSetValidAfter]);
263const std::string Ssl::CrtdMessage::param_SetValidBefore(Ssl::CertAdaptAlgorithmStr[algSetValidBefore]);
264const std::string Ssl::CrtdMessage::param_SetCommonName(Ssl::CertAdaptAlgorithmStr[algSetCommonName]);
Definition: gadgets.h:229
Security::PrivateKeyPointer signWithPkey
The key of the signing certificate.
Definition: gadgets.h:234
Security::CertPointer signWithX509
Certificate to sign the generated request.
Definition: gadgets.h:233
bool setCommonName
Replace the CN field of the mimicking subject with the given.
Definition: gadgets.h:237
void setCode(std::string const &aCode)
Set new request/reply code to compose.
Definition: crtd_message.cc:126
static const std::string param_SetCommonName
Parameter name for passing SetCommonName cert adaptation variable.
Definition: crtd_message.h:84
void composeBody(BodyParams const &map, std::string const &other_part)
Definition: crtd_message.cc:168
static const std::string param_SetValidBefore
Parameter name for passing SetValidBefore cert adaptation variable.
Definition: crtd_message.h:82
static const std::string param_SetValidAfter
Parameter name for passing SetValidAfter cert adaptation variable.
Definition: crtd_message.h:80
static const std::string code_new_certificate
String code for "new_certificate" messages.
Definition: crtd_message.h:76
std::string const & getBody() const
Current body. If parsing is not finished the method returns incompleted body.
Definition: crtd_message.cc:120
void parseBody(BodyParams &map, std::string &other_part) const
Definition: crtd_message.cc:145
static const std::string param_host
Parameter name for passing hostname.
Definition: crtd_message.h:78
std::string const & getCode() const
Current response/request code. If parsing is not finished the method may return incompleted code.
Definition: crtd_message.cc:122
ParseResult parse(const char *buffer, size_t len)
Definition: crtd_message.cc:23
void parseRequest(CertificateProperties &)
orchestrates entire request parsing
Definition: crtd_message.cc:181
std::map< std::string, std::string > BodyParams
Definition: crtd_message.h:27
static const std::string param_Sign
Parameter name for passing signing algorithm.
Definition: crtd_message.h:86
void composeRequest(Ssl::CertificateProperties const &)
Definition: crtd_message.cc:235
CertSignAlgorithm certSignAlgorithmId(const char *sg)
Definition: gadgets.h:191
bool appendCertToMemory(Security::CertPointer const &cert, std::string &bufferToWrite)
Definition: gadgets.cc:121
bool writeCertAndPrivateKeyToMemory(Security::CertPointer const &cert, Security::PrivateKeyPointer const &pkey, std::string &bufferToWrite)
Definition: gadgets.cc:97
bool readCertAndPrivateKeyFromMemory(Security::CertPointer &cert, Security::PrivateKeyPointer &pkey, char const *bufferToRead)
Definition: gadgets.cc:145
Security::CertPointer ReadCertificate(const BIO_Pointer &)
Definition: gadgets.cc:758
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
Definition: Stream.h:63