Commit 17d8e3d7 authored by YannGarcia's avatar YannGarcia
Browse files
parents ce2d8daa 05b0d924
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -83,11 +83,11 @@ public: /*! \publicsection */
   */
  virtual int clear();

  void dump() const;
  void dump() const; // For debug purpose. To be removed

  const std::string cert_to_string(const std::string& p_certificate_id);
  const std::string cert_to_string(const std::string& p_certificate_id); // For debug purpose. To be removed

  int publickey_to_string(const EVP_PKEY* p_public_kep, std::vector<unsigned char>& p_buffer);
  int publickey_to_string(const EVP_PKEY* p_public_kep, std::vector<unsigned char>& p_buffer); // For debug purpose. To be removed


private: /*! \privatesection */
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ public: /*! \publicsection */
   * \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);
  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_canonicalized);
  /*!
   * \fn int build_path(const std::string& p_root_directory);
   * \brief Verify message signature
+2 −2
Original line number Diff line number Diff line
@@ -69,10 +69,10 @@ OCTETSTRING LibSecurity__Hash::fx__hash(const OCTETSTRING& p_to_be_hashed, const
  return hash;
}

INTEGER LibSecurity__Signature::fx__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) {
INTEGER LibSecurity__Signature::fx__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_canonicalized) {
  loggers::get_instance().log_msg(">>> fx__sign: ", p_encoded_message);

  if (_security_services->do_sign(p_encoded_message, p_certificate_name, p_private_key_name, p_private_key_passwd, p_signature, p_digest, p_x509_certificate_subject, p_x509_certificate_pem, p_pull_request_signed_canonicalized) == -1) {
  if (_security_services->do_sign(p_encoded_message, p_certificate_name, p_private_key_name, p_private_key_passwd, p_signature, p_digest, p_x509_certificate_subject, p_x509_certificate_pem, p_pull_request_canonicalized) == -1) {
    loggers::get_instance().log("fx__sign: Failed to signed message");
    return -1;
  }
+4 −4
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ int security_services::load_certificate(const std::string& p_certificate_name, c
  return _certs_db->get_certificate(p_certificate_name, p_private_key_name, p_private_key_passwd, p_certificate);
}

int security_services::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) {
int security_services::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_canonicalized) {
  loggers::get_instance().log_msg(">>> security_services::do_sign: ", p_encoded_message);
  loggers::get_instance().log_msg(">>> security_services::do_sign: ", p_certificate_name);
  loggers::get_instance().log_msg(">>> security_services::do_sign: ", p_private_key_name);
@@ -47,9 +47,9 @@ int security_services::do_sign(const OCTETSTRING& p_encoded_message, const CHARS
  // Canonicalization
  std::string canonicalized;
  xml_converters::get_instance().xml_canonicalization(std::string((const char*)(static_cast<const unsigned char*>(p_encoded_message)), p_encoded_message.lengthof()), canonicalized);
  p_pull_request_signed_canonicalized = CHARSTRING(canonicalized.c_str());
  OCTETSTRING encoded_message(char2oct(p_pull_request_signed_canonicalized));
  loggers::get_instance().log_msg("security_services::do_sign: p_pull_request_signed_canonicalized: ", p_pull_request_signed_canonicalized);
  p_pull_request_canonicalized = CHARSTRING(canonicalized.c_str());
  OCTETSTRING encoded_message(char2oct(p_pull_request_canonicalized));
  loggers::get_instance().log_msg("security_services::do_sign: p_pull_request_canonicalized: ", p_pull_request_canonicalized);

  // Retrieve certificate
  std::string certificate_id;
+2 −2
Original line number Diff line number Diff line
@@ -2,8 +2,6 @@ sources := \
           ttcn/LibHttp_BinaryMessageBodyTypes.ttcn \
           ttcn/LibHttp_EncdecDeclarations.ttcn     \
           ttcn/LibHttp_Functions.ttcn              \
           ttcn/LibHttp_JsonMessageBodyTypes.ttcn   \
           ttcn/LibHttp_JsonTemplates.ttcn          \
           ttcn/LibHttp_JSONTypes.ttcn              \
           ttcn/LibHttp_MessageBodyTypes.ttcn       \
           ttcn/LibHttp_Pics.ttcn                   \
@@ -17,3 +15,5 @@ sources := \
# Please, move and comment the module you need to overwrite tofit your project
#           ttcn/LibHttp_XmlMessageBodyTypes.ttcn    \
#           ttcn/LibHttp_XmlTemplates.ttcn
#           ttcn/LibHttp_JsonMessageBodyTypes.ttcn   \
#           ttcn/LibHttp_JsonTemplates.ttcn          \
Loading