Loading .TITAN_properties +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ <listItem>./bin</listItem> <listItem>./src/bin</listItem> <listItem>./src/bin/asn1</listItem> <listItem>C:\OpenSSL-Win64\include</listItem> <listItem>C:\ProgramFiles\OpenSSL-Win64\include</listItem> <listItem>C:\npcap-sdk-0.1\Include</listItem> <listItem>/Users/yann/Documents/wireshark/cygwin64/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++</listItem> </preprocessorIncludes> Loading .gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -5,3 +5,4 @@ data/certificates/ data/v3/certificates/ data/v3/temp/ data/v3/xer/ /bin/ ccsrc/Externals/LibItsSecurity_externals.cc +12 −10 Original line number Diff line number Diff line Loading @@ -688,6 +688,7 @@ namespace LibItsSecurity__Functions * \param[out] p__encrypted__sym__key The encrypted AES 128 symmetric key * \param[out] p__authentication__vector The tag of the encrypted AES 128 symmetric key * \param[out] p__nonce The nonce vector * \param[in] p__use__hardcoded__values In debug mode, set to true to use hardcoded values * \return The original message * \see IEEE Std 1609.2-2017 Clause 5.3.5 Public key encryption algorithms: ECIES * \see https://www.nominet.uk/researchblog/how-elliptic-curve-cryptography-encryption-works/ Loading @@ -696,25 +697,26 @@ namespace LibItsSecurity__Functions // TODO Use common function for both fx__encryptWithEciesxxx and fx__decryptWithEciesxxx function OCTETSTRING fx__encryptWithEciesNistp256WithSha256(const OCTETSTRING& p__toBeEncryptedSecuredMessage, const OCTETSTRING& p__recipientsPublicKeyCompressed, const INTEGER& p__compressedMode, const OCTETSTRING& p__salt, OCTETSTRING& p__publicEphemeralKeyCompressed, INTEGER& p__ephemeralCompressedMode,OCTETSTRING& p__aes__sym__key, OCTETSTRING& p__encrypted__sym__key, OCTETSTRING& p__authentication__vector, OCTETSTRING& p__nonce, const BOOLEAN& p__use__hardcoded__values) { loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__toBeEncryptedSecuredMessage); loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__recipientsPublicKeyCompressed", p__recipientsPublicKeyCompressed); loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__recipientsPublicKeyCompressed: ", p__recipientsPublicKeyCompressed); loggers::get_instance().log(">>> fx__encryptWithEciesNistp256WithSha256: p__compressedMode: %d", static_cast<int>(p__compressedMode)); loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__salt", p__salt); loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__salt: ", p__salt); loggers::get_instance().log(">>> fx__encryptWithEciesNistp256WithSha256: p__use__hardcoded__values: %x", static_cast<const boolean>(p__use__hardcoded__values)); // 1. Generate new Private/Public Ephemeral key std::unique_ptr<security_ecc> ec; if (!p__use__hardcoded__values) { if (!static_cast<const boolean>(p__use__hardcoded__values)) { ec.reset(new security_ecc(ec_elliptic_curves::nist_p_256)); if (ec->generate() == -1) { loggers::get_instance().warning("fx__encryptWithEciesNistp256WithSha256: Failed to generate ephemeral keys"); return OCTETSTRING(0, nullptr); } } else { ec.reset(new security_ecc(ec_elliptic_curves::nist_p_256, str2oct("EE9CC7FBD9EDECEA41F7C8BD258E8D2E988E75BD069ADDCA1E5A38E534AC6818"), str2oct("5AE3C8D9FE0B1FC7438F29417C240F8BF81C358EC1A4D0C6E98D8EDBCC714017"))); // Private/Public ephemeral keys ec.reset(new security_ecc(ec_elliptic_curves::nist_p_256, str2oct("0722B39ABC7B6C5301CA0408F454F81553D7FE59F492DBF385B6B6D1F81E0F68"))); // Hardcoded private key } // 2. Generate and derive shared secret based on recipient's private keys security_ecc ec_comp(ec_elliptic_curves::nist_p_256, p__recipientsPublicKeyCompressed, (static_cast<int>(p__compressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); if (p__use__hardcoded__values) { ec_comp.symmetric_encryption_key(str2oct("A6342013D623AD6C5F6882469673AE33")); if (static_cast<const boolean>(p__use__hardcoded__values)) { // Set AES encryption key to an harcoded value ec->symmetric_encryption_key(str2oct("5A4E63B247C714644E85CAC49BD26C81")); } if (ec->generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { loggers::get_instance().warning("fx__encryptWithEciesNistp256WithSha256: Failed to generate and derive secret key"); Loading Loading @@ -1147,7 +1149,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the specified certificate * \param p_certificateId the certificate identifier * \param p_certificate_id the certificate identifier * \param p_certificate the expected certificate * \return true on success, false otherwise */ Loading Loading @@ -1179,7 +1181,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the specified certificate digest * \param p_certificateId the certificate identifier * \param p_certificate_id the certificate identifier * \param p_digest the expected certificate * \return true on success, false otherwise */ Loading @@ -1198,7 +1200,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the whole-hash of the certificate * \param p_certificateId the certificate identifier * \param p_certificate_id the certificate identifier * \param p_hash the expected certificate * \return true on success, false otherwise */ Loading @@ -1217,7 +1219,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the private keys for the specified certificate * \param p_certificateId the keys identifier * \param p_certificate_id the keys identifier * \param p_signingPrivateKey the signing private key * \return true on success, false otherwise */ Loading ccsrc/Framework/converter.hh +17 −1 Original line number Diff line number Diff line Loading @@ -338,6 +338,22 @@ public: */ std::string trim(const std::string& p_value, const std::string& p_trim_chars = " \t"); /*! * \brief Convert the provided string into a list of arguments * \param[in] p_value The string value * \param[in] p_separator The separator sequence to use for the spliting process * \return The item list * \code{.cc} * std::string str = "This is a test for spliting a string with a white spave"; * std::vector<std::string> tokens = converter::get_instance().split(str, " "); * std::clog << "Tokens: " << std::endl; * for (auto it = tokens.begin(); it != tokens.end(); ++it) { * std::clog << " " << *it << std::endl; * } * \endcode */ std::vector<std::string> split(const std::string & p_value, const std::string& p_separator); /*! * \brief Convert the provided string into a list of arguments * \param[in] p_value The string value Loading ccsrc/Framework/params.hh +3 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ public: //! \publicsection static const std::string& server; //! HTTP server address (e.g. www.etsi.org) static const std::string& port; //! HTTP server port. Default: 80 static const std::string& use_ssl; //! Set to 1 to use SSL to communicate with the HTTP server. Default: false static const std::string& server_mode; //! Does the test sytem acting as a server. Default: 0 static const std::string& local_port; //! Local listener port. Default: 80 static const std::string& method; //! HTTP method type. Default: POST static const std::string& uri; //! HTTP URI value. Default: / static const std::string& host; //! HTTP Host value. Default: 127.0.0.1 Loading Loading
.TITAN_properties +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ <listItem>./bin</listItem> <listItem>./src/bin</listItem> <listItem>./src/bin/asn1</listItem> <listItem>C:\OpenSSL-Win64\include</listItem> <listItem>C:\ProgramFiles\OpenSSL-Win64\include</listItem> <listItem>C:\npcap-sdk-0.1\Include</listItem> <listItem>/Users/yann/Documents/wireshark/cygwin64/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++</listItem> </preprocessorIncludes> Loading
.gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -5,3 +5,4 @@ data/certificates/ data/v3/certificates/ data/v3/temp/ data/v3/xer/ /bin/
ccsrc/Externals/LibItsSecurity_externals.cc +12 −10 Original line number Diff line number Diff line Loading @@ -688,6 +688,7 @@ namespace LibItsSecurity__Functions * \param[out] p__encrypted__sym__key The encrypted AES 128 symmetric key * \param[out] p__authentication__vector The tag of the encrypted AES 128 symmetric key * \param[out] p__nonce The nonce vector * \param[in] p__use__hardcoded__values In debug mode, set to true to use hardcoded values * \return The original message * \see IEEE Std 1609.2-2017 Clause 5.3.5 Public key encryption algorithms: ECIES * \see https://www.nominet.uk/researchblog/how-elliptic-curve-cryptography-encryption-works/ Loading @@ -696,25 +697,26 @@ namespace LibItsSecurity__Functions // TODO Use common function for both fx__encryptWithEciesxxx and fx__decryptWithEciesxxx function OCTETSTRING fx__encryptWithEciesNistp256WithSha256(const OCTETSTRING& p__toBeEncryptedSecuredMessage, const OCTETSTRING& p__recipientsPublicKeyCompressed, const INTEGER& p__compressedMode, const OCTETSTRING& p__salt, OCTETSTRING& p__publicEphemeralKeyCompressed, INTEGER& p__ephemeralCompressedMode,OCTETSTRING& p__aes__sym__key, OCTETSTRING& p__encrypted__sym__key, OCTETSTRING& p__authentication__vector, OCTETSTRING& p__nonce, const BOOLEAN& p__use__hardcoded__values) { loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__toBeEncryptedSecuredMessage); loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__recipientsPublicKeyCompressed", p__recipientsPublicKeyCompressed); loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__recipientsPublicKeyCompressed: ", p__recipientsPublicKeyCompressed); loggers::get_instance().log(">>> fx__encryptWithEciesNistp256WithSha256: p__compressedMode: %d", static_cast<int>(p__compressedMode)); loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__salt", p__salt); loggers::get_instance().log_msg(">>> fx__encryptWithEciesNistp256WithSha256: p__salt: ", p__salt); loggers::get_instance().log(">>> fx__encryptWithEciesNistp256WithSha256: p__use__hardcoded__values: %x", static_cast<const boolean>(p__use__hardcoded__values)); // 1. Generate new Private/Public Ephemeral key std::unique_ptr<security_ecc> ec; if (!p__use__hardcoded__values) { if (!static_cast<const boolean>(p__use__hardcoded__values)) { ec.reset(new security_ecc(ec_elliptic_curves::nist_p_256)); if (ec->generate() == -1) { loggers::get_instance().warning("fx__encryptWithEciesNistp256WithSha256: Failed to generate ephemeral keys"); return OCTETSTRING(0, nullptr); } } else { ec.reset(new security_ecc(ec_elliptic_curves::nist_p_256, str2oct("EE9CC7FBD9EDECEA41F7C8BD258E8D2E988E75BD069ADDCA1E5A38E534AC6818"), str2oct("5AE3C8D9FE0B1FC7438F29417C240F8BF81C358EC1A4D0C6E98D8EDBCC714017"))); // Private/Public ephemeral keys ec.reset(new security_ecc(ec_elliptic_curves::nist_p_256, str2oct("0722B39ABC7B6C5301CA0408F454F81553D7FE59F492DBF385B6B6D1F81E0F68"))); // Hardcoded private key } // 2. Generate and derive shared secret based on recipient's private keys security_ecc ec_comp(ec_elliptic_curves::nist_p_256, p__recipientsPublicKeyCompressed, (static_cast<int>(p__compressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1); if (p__use__hardcoded__values) { ec_comp.symmetric_encryption_key(str2oct("A6342013D623AD6C5F6882469673AE33")); if (static_cast<const boolean>(p__use__hardcoded__values)) { // Set AES encryption key to an harcoded value ec->symmetric_encryption_key(str2oct("5A4E63B247C714644E85CAC49BD26C81")); } if (ec->generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), p__salt) == -1) { loggers::get_instance().warning("fx__encryptWithEciesNistp256WithSha256: Failed to generate and derive secret key"); Loading Loading @@ -1147,7 +1149,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the specified certificate * \param p_certificateId the certificate identifier * \param p_certificate_id the certificate identifier * \param p_certificate the expected certificate * \return true on success, false otherwise */ Loading Loading @@ -1179,7 +1181,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the specified certificate digest * \param p_certificateId the certificate identifier * \param p_certificate_id the certificate identifier * \param p_digest the expected certificate * \return true on success, false otherwise */ Loading @@ -1198,7 +1200,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the whole-hash of the certificate * \param p_certificateId the certificate identifier * \param p_certificate_id the certificate identifier * \param p_hash the expected certificate * \return true on success, false otherwise */ Loading @@ -1217,7 +1219,7 @@ namespace LibItsSecurity__Functions /** * \brief Read the private keys for the specified certificate * \param p_certificateId the keys identifier * \param p_certificate_id the keys identifier * \param p_signingPrivateKey the signing private key * \return true on success, false otherwise */ Loading
ccsrc/Framework/converter.hh +17 −1 Original line number Diff line number Diff line Loading @@ -338,6 +338,22 @@ public: */ std::string trim(const std::string& p_value, const std::string& p_trim_chars = " \t"); /*! * \brief Convert the provided string into a list of arguments * \param[in] p_value The string value * \param[in] p_separator The separator sequence to use for the spliting process * \return The item list * \code{.cc} * std::string str = "This is a test for spliting a string with a white spave"; * std::vector<std::string> tokens = converter::get_instance().split(str, " "); * std::clog << "Tokens: " << std::endl; * for (auto it = tokens.begin(); it != tokens.end(); ++it) { * std::clog << " " << *it << std::endl; * } * \endcode */ std::vector<std::string> split(const std::string & p_value, const std::string& p_separator); /*! * \brief Convert the provided string into a list of arguments * \param[in] p_value The string value Loading
ccsrc/Framework/params.hh +3 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,9 @@ public: //! \publicsection static const std::string& server; //! HTTP server address (e.g. www.etsi.org) static const std::string& port; //! HTTP server port. Default: 80 static const std::string& use_ssl; //! Set to 1 to use SSL to communicate with the HTTP server. Default: false static const std::string& server_mode; //! Does the test sytem acting as a server. Default: 0 static const std::string& local_port; //! Local listener port. Default: 80 static const std::string& method; //! HTTP method type. Default: POST static const std::string& uri; //! HTTP URI value. Default: / static const std::string& host; //! HTTP Host value. Default: 127.0.0.1 Loading