Commit 8d49e1e8 authored by Denis Filatov's avatar Denis Filatov
Browse files

Merge branch 'STF525' of https://forge.etsi.org/gitlab/ITS/ITS into STF525

parents 747ac2ab ee212de8
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -2,6 +2,7 @@
#include <math.h>
#include <math.h>


#include "base_time.hh"
#include "base_time.hh"
#include "loggers.hh"


#ifndef M_PI
#ifndef M_PI
#define M_PI	3.14159265358979323846
#define M_PI	3.14159265358979323846
@@ -14,13 +15,14 @@ namespace LibItsCommon__Functions


  /**
  /**
   * @desc    This external function gets the current time
   * @desc    This external function gets the current time
   * @return  Timestamp - current time since 01/01/2014 in milliseconds
   * @return  Timestamp - current time since 01/01/2004 in milliseconds
   * @see     fx_getCurrentTime() return TimestampIts
   * @see     fx_getCurrentTime() return TimestampIts
   */
   */
  INTEGER fx__getCurrentTime(
  INTEGER fx__getCurrentTime(
) {
) {
    INTEGER i;
    INTEGER i;
    i.set_long_long_val(base_time::get_instance().get_its_current_time());
    i.set_long_long_val(base_time::get_instance().get_its_current_time_ms());
    loggers::get_instance().log_msg("<<< fx__getCurrentTime: ", i);
    return i;
    return i;
  }
  }
  /**
  /**
@@ -31,7 +33,8 @@ namespace LibItsCommon__Functions
  INTEGER fx__getCurrentTimeUtc(
  INTEGER fx__getCurrentTimeUtc(
) {
) {
    INTEGER i;
    INTEGER i;
    i.set_long_long_val(base_time::get_instance().get_current_time());
    i.set_long_long_val(base_time::get_instance().get_current_time_ms());
    loggers::get_instance().log_msg("<<< fx__getCurrentTimeUtc: ", i);
    return i;
    return i;
  }
  }
  /**
  /**
+9 −14
Original line number Original line Diff line number Diff line
#include "LibItsGeoNetworking_Functions.hh"
#include "LibItsGeoNetworking_Functions.hh"
#include <time.h>

#include <math.h>
#include "base_time.hh"
#include "loggers.hh"


namespace LibItsGeoNetworking__Functions
namespace LibItsGeoNetworking__Functions
{
{
@@ -8,16 +9,10 @@ namespace LibItsGeoNetworking__Functions
         * @return  Unix-Epoch-Time mod 2^32
         * @return  Unix-Epoch-Time mod 2^32
        fx_computeGnTimestamp() return UInt32;
        fx_computeGnTimestamp() return UInt32;
*/
*/
INTEGER fx__computeGnTimestamp(
INTEGER fx__computeGnTimestamp() {
) {
  INTEGER i;
			struct timeval tv;
  i.set_long_long_val(base_time::get_instance().get_its_current_time_ms() % 4294967296); // Expresses the time in milliseconds at which the latitude and longitude of the ITS-S were acquired by the GeoAdhoc router. The time is encoded as: TST =TST(TAI)mod232 where TST(TAI) is the number of elapsed TAI milliseconds since 2004-01-01 00:00:00.000 UTC
			gettimeofday(&tv, NULL);
  loggers::get_instance().log_msg("<<< fx__computeGnTimestamp: ", i);

//			unsigned long long timestampNow = tv.tv_sec*1000 + tv.tv_usec/1000;
    long long timestampNow = tv.tv_sec*1000 + tv.tv_usec/1000;
    INTEGER i = INTEGER();
    i.set_long_long_val(timestampNow % 4294967296);
//			return INTEGER(timestampNow % 4294967296);
  return i;
  return i;
}
}
  
  
+79 −23
Original line number Original line Diff line number Diff line
@@ -853,57 +853,113 @@ namespace LibItsSecurity__Functions
    return message;
    return message;
  }
  }
  
  
  OCTETSTRING fx__encryptWithEciesBrainpoolp256WithSha256(const OCTETSTRING& p__toBeEncryptedSecuredMessage, const OCTETSTRING& p__recipientsPublicKeyCompressed, const INTEGER& p__compressedMode, OCTETSTRING& p__publicEphemeralKeyCompressed, INTEGER& p__ephemeralCompressedMode, OCTETSTRING& p__aes__sym__key, OCTETSTRING& p__encrypted__sym__key, OCTETSTRING& p__authentication__vector, OCTETSTRING& p__nonce) {
  OCTETSTRING fx__encryptWithEciesBrainpoolp256WithSha256(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__encryptWithEciesBrainpoolp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__toBeEncryptedSecuredMessage);
    loggers::get_instance().log_msg(">>> fx__encryptWithEciesBrainpoolp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__toBeEncryptedSecuredMessage);
    loggers::get_instance().log_msg(">>> fx__encryptWithEciesBrainpoolp256WithSha256: p__recipientsPublicKeyCompressed: ", p__recipientsPublicKeyCompressed);
    loggers::get_instance().log_msg(">>> fx__encryptWithEciesBrainpoolp256WithSha256: p__recipientsPublicKeyCompressed: ", p__recipientsPublicKeyCompressed);
    loggers::get_instance().log(">>> fx__encryptWithEciesBrainpoolp256WithSha256: p__compressedMode: %d", static_cast<int>(p__compressedMode));
    loggers::get_instance().log(">>> fx__encryptWithEciesBrainpoolp256WithSha256: p__compressedMode: %d", static_cast<int>(p__compressedMode));
    loggers::get_instance().log_msg(">>> fx__encryptWithEciesBrainpoolp256WithSha256: p__salt: ", p__salt);
    loggers::get_instance().log(">>> fx__encryptWithEciesBrainpoolp256WithSha256: p__use__hardcoded__values: %x", static_cast<const boolean>(p__use__hardcoded__values));
    
    
    // 1. Generate new ephemeral Private/Public keys
    // 1. Generate new Private/Public Ephemeral key
    security_ecc ec(ec_elliptic_curves::brainpool_p_256_r1);
    std::unique_ptr<security_ecc> ec;
    if (ec.generate() == -1) {
    if (!static_cast<const boolean>(p__use__hardcoded__values)) {
      loggers::get_instance().warning(": Failed to generate ephemeral keys");
      ec.reset(new security_ecc(ec_elliptic_curves::brainpool_p_256_r1));
      if (ec->generate() == -1) {
        loggers::get_instance().warning("fx__encryptWithEciesBrainpoolp256WithSha256: Failed to generate ephemeral keys");
        return OCTETSTRING(0, nullptr);
        return OCTETSTRING(0, nullptr);
      }
      }
    // 2. Generate and derive shared secret
    } else {
      ec.reset(new security_ecc(ec_elliptic_curves::brainpool_p_256_r1, str2oct("0722B39ABC7B6C5301CA0408F454F81553D7FE59F492DBF385B6B6D1F81E0F68"))); // Hardcoded private key
    }
    // 2. Generate and derive shared secret based on recipient's private keys
    security_ecc ec_comp(ec_elliptic_curves::brainpool_p_256_r1, p__recipientsPublicKeyCompressed, (static_cast<int>(p__compressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1);
    security_ecc ec_comp(ec_elliptic_curves::brainpool_p_256_r1, p__recipientsPublicKeyCompressed, (static_cast<int>(p__compressedMode) == 0) ? ecc_compressed_mode::compressed_y_0 : ecc_compressed_mode::compressed_y_1);
    if (ec.generate_and_derive_ephemeral_key(encryption_algotithm::aes_128_ccm, ec_comp.public_key_x(), ec_comp.public_key_y(), OCTETSTRING(0, nullptr)) == -1) {
    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__encryptWithEciesBrainpoolp256WithSha256: Failed to generate and derive secret key");
      loggers::get_instance().warning("fx__encryptWithEciesBrainpoolp256WithSha256: Failed to generate and derive secret key");
      return OCTETSTRING(0, nullptr);
      return OCTETSTRING(0, nullptr);
    }
    }
    
    
    // Set the AES symmetric key
    // Set the AES symmetric key
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: AES symmetric key: ", ec.symmetric_encryption_key());
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: AES symmetric key: ", ec->symmetric_encryption_key());
    p__aes__sym__key = ec.symmetric_encryption_key();
    p__aes__sym__key = ec->symmetric_encryption_key();
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: p__aes__sym__key: ", p__aes__sym__key);
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: p__aes__sym__key: ", p__aes__sym__key);
    // Set the encrypted symmetric key
    // Set the encrypted symmetric key
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: Symmetric encryption key: ", ec.symmetric_encryption_key());
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: Encrypted symmetric key: ", ec->encrypted_symmetric_key());
    p__encrypted__sym__key = ec.encrypted_symmetric_key();
    p__encrypted__sym__key = ec->encrypted_symmetric_key();
    loggers::get_instance().log_msg("fx__encryptWithEciesNistp256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key);
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key);
    // Set the tag of the symmetric key encryption
    // Set the tag of the symmetric key encryption
    p__authentication__vector = ec.tag();
    p__authentication__vector = ec->tag();
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: p__authentication__vector: ", p__authentication__vector);
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: p__authentication__vector: ", p__authentication__vector);
    // Set ephemeral public keys
    // Set ephemeral public keys
    p__publicEphemeralKeyCompressed = ec.public_key_compressed();
    p__publicEphemeralKeyCompressed = ec->public_key_compressed();
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: Ephemeral public compressed key: ", p__publicEphemeralKeyCompressed);
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: Ephemeral public compressed key: ", p__publicEphemeralKeyCompressed);
    p__ephemeralCompressedMode = (ec.public_key_compressed_mode() == ecc_compressed_mode::compressed_y_0) ? 0 : 1;
    p__ephemeralCompressedMode = (ec->public_key_compressed_mode() == ecc_compressed_mode::compressed_y_0) ? 0 : 1;
    loggers::get_instance().log("fx__encryptWithEciesBrainpoolp256WithSha256: Ephemeral public compressed mode: %d: ", p__ephemeralCompressedMode);
    loggers::get_instance().log("fx__encryptWithEciesBrainpoolp256WithSha256: Ephemeral public compressed mode: %d: ", p__ephemeralCompressedMode);
    // 3. Retrieve AES 128 parameters
    // 3. Retrieve AES 128 parameters
    p__nonce = ec.nonce();
    p__nonce = ec->nonce();
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: p__nonce: ", p__nonce);
    loggers::get_instance().log_msg("fx__encryptWithEciesBrainpoolp256WithSha256: p__nonce: ", p__nonce);
    OCTETSTRING enc_symm_key = ec.symmetric_encryption_key();
    loggers::get_instance().log_msg(": enc_symm_key: ", enc_symm_key);
    // 4. Encrypt the data using AES-128 CCM
    // 4. Encrypt the data using AES-128 CCM
    OCTETSTRING enc_message;
    OCTETSTRING enc_message;
    if (ec.encrypt(encryption_algotithm::aes_128_ccm, ec.symmetric_encryption_key(), ec.nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) {
    if (ec->encrypt(encryption_algotithm::aes_128_ccm, ec->symmetric_encryption_key(), ec->nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) {
      loggers::get_instance().warning("fx__encryptWithEciesBrainpoolp256WithSha256: Failed to encrypt message");
      loggers::get_instance().warning("fx__encryptWithEciesBrainpoolp256WithSha256: Failed to encrypt message");
      return OCTETSTRING(0, nullptr);
      return OCTETSTRING(0, nullptr);
    }
    }
    enc_message += ec.tag();
    enc_message += ec->tag();
    loggers::get_instance().log_to_hexa("fx__encryptWithEciesBrainpoolp256WithSha256: enc message||Tag: ", enc_message);
    loggers::get_instance().log_to_hexa("fx__encryptWithEciesBrainpoolp256WithSha256: enc message||Tag: ", enc_message);


    return enc_message;
    return enc_message;
  }
  }


  /**
   * @desc Test function for ECIES BRAINPOOL P-256r1 Encryption with SHA-256
   * @remark For the purpose of testing, the content of p__toBeEncryptedSecuredMessage is the AES 128 symmetric key to be encrypted
   */
  OCTETSTRING fx__test__encryptWithEciesBrainpoolp256WithSha256(const OCTETSTRING& p__toBeEncryptedSecuredMessage, const OCTETSTRING& p__privateEphemeralKey, const OCTETSTRING& p__recipientPublicKeyX, const OCTETSTRING& p__recipientPublicKeyY, const OCTETSTRING& p__salt, OCTETSTRING& p__publicEphemeralKeyX, OCTETSTRING& p__publicEphemeralKeyY, OCTETSTRING& p__aes__sym__key, OCTETSTRING& p__encrypted__sym__key, OCTETSTRING& p__authentication__vector, OCTETSTRING& p__nonce) {
    
    // 1. Generate new ephemeral Private/Public keys
    security_ecc ec(ec_elliptic_curves::brainpool_p_256_r1, p__privateEphemeralKey);
    p__publicEphemeralKeyX = ec.public_key_x();
    p__publicEphemeralKeyY = ec.public_key_y();
    loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256WithSha256: Vx=", p__publicEphemeralKeyX);
    loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256WithSha256: Vy=", p__publicEphemeralKeyY);
    
    // 2. Generate and derive shared secret
    security_ecc ec_comp(ec_elliptic_curves::brainpool_p_256_r1, p__recipientPublicKeyX, p__recipientPublicKeyY);
    ec.symmetric_encryption_key(p__toBeEncryptedSecuredMessage);
    loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256WithSha256: ", ec.encrypted_symmetric_key());
    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__test__encryptWithEciesBrainpoolp256WithSha256: Failed to generate and derive secret key");
      return OCTETSTRING(0, nullptr);
    }
    
    // Set the AES symmetric key
    loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256WithSha256: AES symmetric key: ", ec.symmetric_encryption_key());
    p__aes__sym__key = ec.symmetric_encryption_key();
    loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256WithSha256: p__aes__sym__key: ", p__aes__sym__key);
    // Set the encrypted symmetric key
    loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256WithSha256: Encrypted symmetric key: ", ec.encrypted_symmetric_key());
    p__encrypted__sym__key = ec.encrypted_symmetric_key();
    loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256WithSha256: p__encrypted__sym__key: ", p__encrypted__sym__key);
    // Set the tag of the symmetric key encryption
    p__authentication__vector = ec.tag();
    loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256WithSha256: p__authentication__vector: ", p__authentication__vector);
    // 3. Retrieve AES 128 parameters
    p__nonce = ec.nonce();
    loggers::get_instance().log_msg("fx__test__encryptWithEciesBrainpoolp256WithSha256: p__nonce: ", p__nonce);
    // 4. Encrypt the data using AES-128 CCM
    OCTETSTRING enc_message;
    if (ec.encrypt(encryption_algotithm::aes_128_ccm, ec.symmetric_encryption_key(), ec.nonce(), p__toBeEncryptedSecuredMessage, enc_message) == -1) {
      loggers::get_instance().warning("fx__test__encryptWithEciesBrainpoolp256WithSha256: Failed to encrypt message");
      return OCTETSTRING(0, nullptr);
    }
    enc_message += ec.tag();
    loggers::get_instance().log_to_hexa("fx__test__encryptWithEciesBrainpoolp256WithSha256: enc message||Tag: ", enc_message);
    
    return enc_message;
  }
  
  OCTETSTRING fx__decryptWithEciesBrainpoolp256WithSha256(const OCTETSTRING& p__encryptedSecuredMessage, const OCTETSTRING& p__privateEncKey, const OCTETSTRING& p__publicEphemeralKeyCompressed, const INTEGER& p__ephemeralCompressedMode, const OCTETSTRING& p__encrypted__sym__key, const OCTETSTRING& p__authentication__vector, const OCTETSTRING& p__nonce) {
  OCTETSTRING fx__decryptWithEciesBrainpoolp256WithSha256(const OCTETSTRING& p__encryptedSecuredMessage, const OCTETSTRING& p__privateEncKey, const OCTETSTRING& p__publicEphemeralKeyCompressed, const INTEGER& p__ephemeralCompressedMode, const OCTETSTRING& p__encrypted__sym__key, const OCTETSTRING& p__authentication__vector, const OCTETSTRING& p__nonce) {
    loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage);
    loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256WithSha256: p__toBeEncryptedSecuredMessage: ", p__encryptedSecuredMessage);
    loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256WithSha256: p__privateEncKey: ", p__privateEncKey);
    loggers::get_instance().log_msg(">>> fx__decryptWithEciesBrainpoolp256WithSha256: p__privateEncKey: ", p__privateEncKey);
+20 −9
Original line number Original line Diff line number Diff line
@@ -17,7 +17,7 @@
 * \brief This class provides time tools such as getting current time
 * \brief This class provides time tools such as getting current time
 */
 */
class base_time {
class base_time {
  const unsigned long long its_base_time = 1072915200000L; //! Base time 01/01/2004 12:00am in millseconds
  const unsigned long long its_base_time_ms = 1072915200000L; //! Base time 01/01/2004 12:00am in millseconds
  
  
  static base_time* _instance;
  static base_time* _instance;
private:
private:
@@ -28,9 +28,11 @@ public:
  virtual ~base_time() { if (_instance != nullptr) delete _instance; };
  virtual ~base_time() { if (_instance != nullptr) delete _instance; };
  
  
public:
public:
  inline const unsigned long long get_current_time() const;
  inline const unsigned long long get_current_time_ms() const;
  inline const unsigned long long get_its_base_time() const;
  inline const unsigned long long get_its_base_time_ms() const;
  inline const unsigned long long get_its_current_time() const;
  inline const unsigned long long get_its_current_time_ms() const;
  inline const unsigned long long get_its_current_time_us() const;
  inline const unsigned long long get_its_current_time_mod_ms() const;
}; // End of class base_time
}; // End of class base_time


// static functions
// static functions
@@ -38,14 +40,23 @@ base_time& base_time::get_instance() {
  return (_instance != nullptr) ? *_instance : *(_instance = new base_time());
  return (_instance != nullptr) ? *_instance : *(_instance = new base_time());
}
}


const unsigned long long base_time::get_current_time() const {
const unsigned long long base_time::get_current_time_ms() const {
  return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
  return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}
}


const unsigned long long base_time::get_its_base_time() const {
const unsigned long long base_time::get_its_base_time_ms() const {
  return base_time::its_base_time;
  return base_time::its_base_time_ms;
}
}


const unsigned long long base_time::get_its_current_time() const {
const unsigned long long base_time::get_its_current_time_ms() const {
  return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() - base_time::its_base_time;
  return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() - base_time::its_base_time_ms;
}
}

const unsigned long long base_time::get_its_current_time_us() const {
  return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch()).count() - base_time::its_base_time_ms * 1000;
}

const unsigned long long base_time::get_its_current_time_mod_ms() const {
  return (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() - base_time::its_base_time_ms) % 65536;
}
+37 −4
Original line number Original line Diff line number Diff line
@@ -114,13 +114,13 @@ public:
   * \param[in] p_value The string value
   * \param[in] p_value The string value
   * \return The hexadecimal value
   * \return The hexadecimal value
   */
   */
  std::string string_to_hexa(const std::string & p_value);
  std::string string_to_hexa(const std::string & p_value, const bool p_uppercase = false);
  /*!
  /*!
   * \brief Convert a bytes array int32_t an hexadecimal string
   * \brief Convert a bytes array int32_t an hexadecimal string
   * \param[in] p_value The bytes array value
   * \param[in] p_value The bytes array value
   * \return The hexadecimal value
   * \return The hexadecimal value
   */
   */
  std::string bytes_to_hexa(const std::vector<uint8_t> & p_value);
  std::string bytes_to_hexa(const std::vector<uint8_t> & p_value, const bool p_uppercase = false);
  /*!
  /*!
   * \brief Convert an hexadecimal string into a bytes array
   * \brief Convert an hexadecimal string into a bytes array
   * \param[in] p_value The hexadecimal value
   * \param[in] p_value The hexadecimal value
@@ -328,6 +328,22 @@ public:
    return ss.str();
    return ss.str();
  }; // End of string_to_bytes
  }; // End of string_to_bytes


  /*!
   * \brief Convert a string in to lower case
   * \param[in/out] p_value The string value to convert
   */
  inline void to_lower(std::string& p_value) {
    std::transform(p_value.begin(), p_value.end(), p_value.begin(), ::tolower);
  }
  
  /*!
   * \brief Convert a string in to upper case
   * \param[in/out] p_value The string value to convert
   */
  inline void to_upper(std::string& p_value) {
    std::transform(p_value.begin(), p_value.end(), p_value.begin(), ::toupper);
  }
  
public:
public:
  
  
  /*!
  /*!
@@ -369,5 +385,22 @@ public:
   */
   */
  std::vector<std::string> split_arguments_line(const std::string & p_value);
  std::vector<std::string> split_arguments_line(const std::string & p_value);
  
  
  static const std::string lut;
  /*!
   * \brief Convert the provided buffer into a Base64
   * \param[in] p_value The buffer value
   * \return The Base64 encoded buffert
   */
  std::vector<unsigned char> buffer_to_base64(const std::vector<unsigned char> & p_value);
  
  /*!
   * \brief Convert the provided Base64 buffer 
   * \param[in] p_value The buffer value
   * \return The Base64 encoded buffert
   */
  std::vector<unsigned char> base64_to_buffer(const std::vector<unsigned char> & p_value);

  static const std::string lut_u;
  static const std::string lut_l;
  static const std::string base64_enc_map;
  
}; // End of class converter
}; // End of class converter
Loading