CR fix 2

Change-Id: Ib5b7d7ff17f6ae31e9b6d905ef53d015a7389ccc
diff --git a/src/identity-challenge/challenge-credential.cpp b/src/identity-challenge/challenge-credential.cpp
index adee8b0..7e72805 100644
--- a/src/identity-challenge/challenge-credential.cpp
+++ b/src/identity-challenge/challenge-credential.cpp
@@ -137,7 +137,7 @@
 ChallengeCredential::genChallengeRequestTLV(Status status, const std::string& challengeStatus,
                                             std::vector<std::tuple<std::string, std::string>>&& params)
 {
-  Block request = makeEmptyBlock(tlv::EncryptedPayload);
+  Block request(tlv::EncryptedPayload);
   if (status == Status::BEFORE_CHALLENGE) {
     if (params.size() != 2) {
       NDN_THROW(std::runtime_error("Wrong parameter provided."));
@@ -146,7 +146,7 @@
     for (const auto& item : params) {
       if (std::get<0>(item) == PARAMETER_KEY_CREDENTIAL_CERT) {
         request.push_back(makeStringBlock(tlv::ParameterKey, PARAMETER_KEY_CREDENTIAL_CERT));
-        Block valueBlock = makeEmptyBlock(tlv::ParameterValue);
+        Block valueBlock(tlv::ParameterValue);
         auto& certTlvStr = std::get<1>(item);
         valueBlock.push_back(Block((uint8_t*)certTlvStr.c_str(), certTlvStr.size()));
         request.push_back(valueBlock);
diff --git a/src/identity-challenge/challenge-email.cpp b/src/identity-challenge/challenge-email.cpp
index e979753..332ef96 100644
--- a/src/identity-challenge/challenge-email.cpp
+++ b/src/identity-challenge/challenge-email.cpp
@@ -20,6 +20,7 @@
 
 #include "challenge-email.hpp"
 #include <regex>
+#include <boost/process.hpp>
 
 namespace ndn {
 namespace ndncert {
@@ -125,7 +126,7 @@
 ChallengeEmail::genChallengeRequestTLV(Status status, const std::string& challengeStatus,
                                        std::vector<std::tuple<std::string, std::string>>&& params)
 {
-  Block request = makeEmptyBlock(tlv::EncryptedPayload);
+  Block request(tlv::EncryptedPayload);
   if (status == Status::BEFORE_CHALLENGE) {
     if (params.size() != 1 || std::get<0>(params[0]) != PARAMETER_KEY_EMAIL) {
       NDN_THROW(std::runtime_error("Wrong parameter provided."));
@@ -165,13 +166,13 @@
   command += " \"" + emailAddress + "\" \"" + secret + "\" \"" +
              request.m_caPrefix.toUri() + "\" \"" +
              request.m_cert.getName().toUri() + "\"";
-  int result = system(command.c_str());
-  if (result == -1) {
+  boost::process::child child(command);
+  child.wait();
+  if (child.exit_code() != 0) {
     NDN_LOG_TRACE("EmailSending Script " + m_sendEmailScript + " fails.");
   }
   NDN_LOG_TRACE("EmailSending Script " + m_sendEmailScript +
-             " was executed successfully with return value" + std::to_string(result) + ".");
-  return;
+             " was executed successfully with return value 0.");
 }
 
 } // namespace ndncert
diff --git a/src/identity-challenge/challenge-pin.cpp b/src/identity-challenge/challenge-pin.cpp
index 66f5fec..34b987d 100644
--- a/src/identity-challenge/challenge-pin.cpp
+++ b/src/identity-challenge/challenge-pin.cpp
@@ -107,7 +107,7 @@
 ChallengePin::genChallengeRequestTLV(Status status, const std::string& challengeStatus,
                                      std::vector<std::tuple<std::string, std::string>>&& params)
 {
-  Block request = makeEmptyBlock(tlv::EncryptedPayload);
+  Block request(tlv::EncryptedPayload);
   if (status == Status::BEFORE_CHALLENGE) {
     request.push_back(makeStringBlock(tlv::SelectedChallenge, CHALLENGE_TYPE));
   }