Loading ccsrc/Framework/include/converter.hh +9 −0 Original line number Diff line number Diff line Loading @@ -366,6 +366,15 @@ public: */ std::vector<std::string> split_arguments_line(const std::string& p_value); /*! * \brief Replace string or character into the the provided string * \param[in] p_value The original string value * \param[in] p_from The pattern to be replaced * \param[in] p_to The new pattern * \return The modified string */ std::string replace(const std::string& p_value, const std::string& p_from, const std::string& p_to); /*! * \brief Convert the provided buffer into a Base64 * \param[in] p_value The buffer value Loading ccsrc/Framework/src/converter.cc +10 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,16 @@ static std::string insert_linebreaks(std::string str, size_t distance) { return str; } std::string converter::replace(const std::string& p_value, const std::string& p_from, const std::string& p_to) { size_t start_pos = 0; std::string str(p_value); while((start_pos = str.find(p_from, start_pos)) != std::string::npos) { str.replace(start_pos, p_from.length(), p_to); start_pos += p_to.length(); // Handles case where 'p_to' is a substring of 'p_from' } return str; } std::vector<unsigned char> converter::buffer_to_base64(const std::vector<unsigned char> &p_value, const bool p_is_url) { const std::string& base64_enc_map_ = converter::base64_enc_map[(p_is_url) ? 1 : 0]; const unsigned char trailing_char = (p_is_url) ? '.' : '='; Loading ccsrc/security/include/certs_cache.hh +5 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,11 @@ public: /*! \publicsection */ void dump() const; const std::string cert_to_string(const std::string& p_certificate_id); int publickey_to_string(const EVP_PKEY* p_public_kep, std::vector<unsigned char>& p_buffer); private: /*! \privatesection */ /*! * \fn int load_certificate(const std::string& p_certificate_name, const std::string& p_private_key_name, const std::string& p_private_key_passwd, const certs_db_record** p_record); Loading ccsrc/security/include/certs_db_record.hh +1 −0 Original line number Diff line number Diff line Loading @@ -62,5 +62,6 @@ public: /*! \publicsection */ inline const EVP_PKEY* private_key() const { return _private_key; }; inline const EVP_PKEY* public_key() const { return ::X509_get_pubkey(_certificate); }; inline const X509_NAME* subject_name() const { return ::X509_get_subject_name(_certificate); }; inline const X509_NAME* issuer() const { return ::X509_get_issuer_name(_certificate); }; inline const std::string& pem() const { return _pem; }; }; // End of class certs_db_record ccsrc/security/include/security_services.hh +2 −5 Original line number Diff line number Diff line Loading @@ -45,10 +45,7 @@ public: /*! \publicsection */ * \fn int do_sign(const OCTETSTRING& p_encoded_message, const CHARSTRING& p_certificate_name, const CHARSTRING& p_private_key_name, const CHARSTRING& p_private_key_passwd, OCTETSTRING& p_signature, OCTETSTRING& p_digest, CHARSTRING& p_x509_certificate_subject, CHARSTRING& p_x509_certificate_pem); * \brief Sign message * \param[in] p_encoded_message The raw message to be signed * \param[in] p_encoded_message The raw message to be signed * \param[in] p_encoded_message The raw message to be signed * \param[in] p_encoded_message The raw message to be signed * \param[in] p_encoded_message The raw message to be signed * \param[in] TODO The raw message to be signed * \return 0 on success, -1 otherwise */ int do_sign(const OCTETSTRING& p_encoded_message, const CHARSTRING& p_certificate_name, const CHARSTRING& p_private_key_name, const CHARSTRING& p_private_key_passwd, OCTETSTRING& p_signature, OCTETSTRING& p_digest, CHARSTRING& p_x509_certificate_subject, CHARSTRING& p_x509_certificate_pem, CHARSTRING& p_pull_request_signed_canonicalized); Loading @@ -59,5 +56,5 @@ public: /*! \publicsection */ * \param[in] TODO * \return true on success, false otherwise */ bool do_sign_verify(const CHARSTRING& p_message, const UNIVERSAL_CHARSTRING& p_canonicalization_method, const UNIVERSAL_CHARSTRING& p_signature_method, const UNIVERSAL_CHARSTRING& p_digest_method, const UNIVERSAL_CHARSTRING& p_digest_value, const UNIVERSAL_CHARSTRING& p_signature_value, const UNIVERSAL_CHARSTRING& p_subject_name, const UNIVERSAL_CHARSTRING& p_certificate); bool do_sign_verify(const CHARSTRING& p_message, const UNIVERSAL_CHARSTRING& p_canonicalization_method, const UNIVERSAL_CHARSTRING& p_signature_method, const UNIVERSAL_CHARSTRING& p_digest_method, const UNIVERSAL_CHARSTRING& p_digest_value, const UNIVERSAL_CHARSTRING& p_signature_value, const UNIVERSAL_CHARSTRING& p_subject_name, const UNIVERSAL_CHARSTRING& p_certificate, const CHARSTRING& p_debug_message); }; No newline at end of file Loading
ccsrc/Framework/include/converter.hh +9 −0 Original line number Diff line number Diff line Loading @@ -366,6 +366,15 @@ public: */ std::vector<std::string> split_arguments_line(const std::string& p_value); /*! * \brief Replace string or character into the the provided string * \param[in] p_value The original string value * \param[in] p_from The pattern to be replaced * \param[in] p_to The new pattern * \return The modified string */ std::string replace(const std::string& p_value, const std::string& p_from, const std::string& p_to); /*! * \brief Convert the provided buffer into a Base64 * \param[in] p_value The buffer value Loading
ccsrc/Framework/src/converter.cc +10 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,16 @@ static std::string insert_linebreaks(std::string str, size_t distance) { return str; } std::string converter::replace(const std::string& p_value, const std::string& p_from, const std::string& p_to) { size_t start_pos = 0; std::string str(p_value); while((start_pos = str.find(p_from, start_pos)) != std::string::npos) { str.replace(start_pos, p_from.length(), p_to); start_pos += p_to.length(); // Handles case where 'p_to' is a substring of 'p_from' } return str; } std::vector<unsigned char> converter::buffer_to_base64(const std::vector<unsigned char> &p_value, const bool p_is_url) { const std::string& base64_enc_map_ = converter::base64_enc_map[(p_is_url) ? 1 : 0]; const unsigned char trailing_char = (p_is_url) ? '.' : '='; Loading
ccsrc/security/include/certs_cache.hh +5 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,11 @@ public: /*! \publicsection */ void dump() const; const std::string cert_to_string(const std::string& p_certificate_id); int publickey_to_string(const EVP_PKEY* p_public_kep, std::vector<unsigned char>& p_buffer); private: /*! \privatesection */ /*! * \fn int load_certificate(const std::string& p_certificate_name, const std::string& p_private_key_name, const std::string& p_private_key_passwd, const certs_db_record** p_record); Loading
ccsrc/security/include/certs_db_record.hh +1 −0 Original line number Diff line number Diff line Loading @@ -62,5 +62,6 @@ public: /*! \publicsection */ inline const EVP_PKEY* private_key() const { return _private_key; }; inline const EVP_PKEY* public_key() const { return ::X509_get_pubkey(_certificate); }; inline const X509_NAME* subject_name() const { return ::X509_get_subject_name(_certificate); }; inline const X509_NAME* issuer() const { return ::X509_get_issuer_name(_certificate); }; inline const std::string& pem() const { return _pem; }; }; // End of class certs_db_record
ccsrc/security/include/security_services.hh +2 −5 Original line number Diff line number Diff line Loading @@ -45,10 +45,7 @@ public: /*! \publicsection */ * \fn int do_sign(const OCTETSTRING& p_encoded_message, const CHARSTRING& p_certificate_name, const CHARSTRING& p_private_key_name, const CHARSTRING& p_private_key_passwd, OCTETSTRING& p_signature, OCTETSTRING& p_digest, CHARSTRING& p_x509_certificate_subject, CHARSTRING& p_x509_certificate_pem); * \brief Sign message * \param[in] p_encoded_message The raw message to be signed * \param[in] p_encoded_message The raw message to be signed * \param[in] p_encoded_message The raw message to be signed * \param[in] p_encoded_message The raw message to be signed * \param[in] p_encoded_message The raw message to be signed * \param[in] TODO The raw message to be signed * \return 0 on success, -1 otherwise */ int do_sign(const OCTETSTRING& p_encoded_message, const CHARSTRING& p_certificate_name, const CHARSTRING& p_private_key_name, const CHARSTRING& p_private_key_passwd, OCTETSTRING& p_signature, OCTETSTRING& p_digest, CHARSTRING& p_x509_certificate_subject, CHARSTRING& p_x509_certificate_pem, CHARSTRING& p_pull_request_signed_canonicalized); Loading @@ -59,5 +56,5 @@ public: /*! \publicsection */ * \param[in] TODO * \return true on success, false otherwise */ bool do_sign_verify(const CHARSTRING& p_message, const UNIVERSAL_CHARSTRING& p_canonicalization_method, const UNIVERSAL_CHARSTRING& p_signature_method, const UNIVERSAL_CHARSTRING& p_digest_method, const UNIVERSAL_CHARSTRING& p_digest_value, const UNIVERSAL_CHARSTRING& p_signature_value, const UNIVERSAL_CHARSTRING& p_subject_name, const UNIVERSAL_CHARSTRING& p_certificate); bool do_sign_verify(const CHARSTRING& p_message, const UNIVERSAL_CHARSTRING& p_canonicalization_method, const UNIVERSAL_CHARSTRING& p_signature_method, const UNIVERSAL_CHARSTRING& p_digest_method, const UNIVERSAL_CHARSTRING& p_digest_value, const UNIVERSAL_CHARSTRING& p_signature_value, const UNIVERSAL_CHARSTRING& p_subject_name, const UNIVERSAL_CHARSTRING& p_certificate, const CHARSTRING& p_debug_message); }; No newline at end of file