Fixed several ndncert-client bugs and use lower case Challenge ID
refs: #4962
Change-Id: Id10dcc15cb718d6a55f4657884b2c6be3f653867
diff --git a/src/client-module.cpp b/src/client-module.cpp
index 28e535b..12d835d 100644
--- a/src/client-module.cpp
+++ b/src/client-module.cpp
@@ -194,12 +194,11 @@
const auto& peerKeyBase64Str = contentJson.get<std::string>(JSON_CA_ECDH, "");
const auto& saltStr = contentJson.get<std::string>(JSON_CA_SALT, "");
uint64_t saltInt = std::stoull(saltStr);
- uint8_t salt[sizeof(saltInt)];
- std::memcpy(salt, &saltInt, sizeof(saltInt));
m_ecdh.deriveSecret(peerKeyBase64Str);
// HKDF
- hkdf(m_ecdh.context->sharedSecret, m_ecdh.context->sharedSecretLen, salt, sizeof(saltInt), m_aesKey, 32);
+ hkdf(m_ecdh.context->sharedSecret, m_ecdh.context->sharedSecretLen,
+ (uint8_t*)&saltInt, sizeof(saltInt), m_aesKey, sizeof(m_aesKey));
// update state
m_status = contentJson.get<int>(JSON_CA_STATUS);
@@ -228,7 +227,7 @@
std::stringstream ss;
boost::property_tree::write_json(ss, paramJson);
auto payload = ss.str();
- auto paramBlock = genEncBlock(tlv::ApplicationParameters, m_aesKey, 32,
+ auto paramBlock = genEncBlock(tlv::ApplicationParameters, m_aesKey, sizeof(m_aesKey),
(const uint8_t*)payload.c_str(), payload.size());
interest->setApplicationParameters(paramBlock);
@@ -243,7 +242,7 @@
_LOG_ERROR("Cannot verify data signature from " << m_ca.m_caName.toUri());
return;
}
- auto result = parseEncBlock(m_aesKey, 32, reply.getContent());
+ auto result = parseEncBlock(m_aesKey, sizeof(m_aesKey), reply.getContent());
std::string payload((const char*)result.data(), result.size());
std::istringstream ss(payload);
JsonSection contentJson;