Commit febb070d authored by garciay's avatar garciay
Browse files

Bug fixed in certificate generation

parent 7d749e61
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -208,7 +208,6 @@ int security_cache::store_certificate(const CHARSTRING& p_cert_id, const OCTETST
  std::vector<unsigned char> private_key(static_cast<const unsigned char*>(p_private_key), static_cast<const unsigned char*>(p_private_key) + p_private_key.lengthof());
  std::vector<unsigned char> public_key_x(static_cast<const unsigned char*>(p_public_key_x), static_cast<const unsigned char*>(p_public_key_x) + p_public_key_x.lengthof());
  std::vector<unsigned char> public_key_y(static_cast<const unsigned char*>(p_public_key_y), static_cast<const unsigned char*>(p_public_key_y) + p_public_key_y.lengthof());

  std::vector<unsigned char> public_comp_key(static_cast<const unsigned char*>(p_public_compressed_key), static_cast<const unsigned char*>(p_public_compressed_key) + p_public_compressed_key.lengthof());
  public_comp_key.insert(public_comp_key.begin(), (unsigned char)(2 + p_public_compressed_key_mode)); // Add one byte to indicate cmpressed-y-0 (0x02) or compressed-y-1 (0x03)
  loggers::get_instance().log_to_hexa("security_cache::store_certificate: public_comp_key: ", public_comp_key.data(), public_comp_key.size());
@@ -224,7 +223,7 @@ int security_cache::store_certificate(const CHARSTRING& p_cert_id, const OCTETST
    private_enc_key.assign(static_cast<const unsigned char*>(p_private_enc_key), static_cast<const unsigned char*>(p_private_enc_key) + p_private_enc_key.lengthof());
    public_enc_key_x.assign(static_cast<const unsigned char*>(p_public_enc_key_x), static_cast<const unsigned char*>(p_public_enc_key_x) + p_public_enc_key_x.lengthof());
    public_enc_key_y.assign(static_cast<const unsigned char*>(p_public_enc_key_y), static_cast<const unsigned char*>(p_public_enc_key_y) + p_public_enc_key_y.lengthof());
  public_comp_key.assign(static_cast<const unsigned char*>(p_public_enc_compressed_key), static_cast<const unsigned char*>(p_public_enc_compressed_key) + p_public_enc_compressed_key.lengthof());
    public_enc_comp_key.assign(static_cast<const unsigned char*>(p_public_enc_compressed_key), static_cast<const unsigned char*>(p_public_enc_compressed_key) + p_public_enc_compressed_key.lengthof());
    public_enc_comp_key.insert(public_enc_comp_key.begin(), (unsigned char)(2 + p_public_compressed_key_mode)); // Add one byte to indicate cmpressed-y-0 (0x02) or compressed-y-1 (0x03)
    loggers::get_instance().log_to_hexa("security_cache::store_certificate: public_enc_comp_key: ", public_enc_comp_key.data(), public_enc_comp_key.size());
  } // else, no encryption keys