CR fix 3

Change-Id: If6802a52f48870a1fe3c42d57d7797a5f5248b26
diff --git a/src/identity-challenge/challenge-credential.cpp b/src/identity-challenge/challenge-credential.cpp
index 7e72805..a9ebe1c 100644
--- a/src/identity-challenge/challenge-credential.cpp
+++ b/src/identity-challenge/challenge-credential.cpp
@@ -121,13 +121,13 @@
 }
 
 // For Client
-std::vector<std::tuple<std::string, std::string>>
+std::multimap<std::string, std::string>
 ChallengeCredential::getRequestedParameterList(Status status, const std::string& challengeStatus)
 {
-  std::vector<std::tuple<std::string, std::string>> result;
+  std::multimap<std::string, std::string> result;
   if (status == Status::BEFORE_CHALLENGE) {
-    result.push_back(std::make_tuple(PARAMETER_KEY_CREDENTIAL_CERT, "Please provide the certificate issued by a trusted CA."));
-    result.push_back(std::make_tuple(PARAMETER_KEY_PROOF_OF_PRIVATE_KEY, "Please sign a Data packet with request ID as the content."));
+    result.emplace(PARAMETER_KEY_CREDENTIAL_CERT, "Please provide the certificate issued by a trusted CA.");
+    result.emplace(PARAMETER_KEY_PROOF_OF_PRIVATE_KEY, "Please sign a Data packet with request ID as the content.");
     return result;
   }
   NDN_THROW(std::runtime_error("Unexpected status or challenge status."));
@@ -135,7 +135,7 @@
 
 Block
 ChallengeCredential::genChallengeRequestTLV(Status status, const std::string& challengeStatus,
-                                            std::vector<std::tuple<std::string, std::string>>&& params)
+                                            std::multimap<std::string, std::string>&& params)
 {
   Block request(tlv::EncryptedPayload);
   if (status == Status::BEFORE_CHALLENGE) {
@@ -170,7 +170,7 @@
 }
 
 void
-ChallengeCredential::fulfillParameters(std::vector<std::tuple<std::string, std::string>>& params,
+ChallengeCredential::fulfillParameters(std::multimap<std::string, std::string>& params,
                                        KeyChain& keyChain, const Name& issuedCertName, const RequestId& requestId)
 {
   auto& pib = keyChain.getPib();
diff --git a/src/identity-challenge/challenge-credential.hpp b/src/identity-challenge/challenge-credential.hpp
index 72db981..7b48483 100644
--- a/src/identity-challenge/challenge-credential.hpp
+++ b/src/identity-challenge/challenge-credential.hpp
@@ -56,15 +56,15 @@
   handleChallengeRequest(const Block& params, ca::RequestState& request) override;
 
   // For Client
-  std::vector<std::tuple<std::string, std::string>>
+  std::multimap<std::string, std::string>
   getRequestedParameterList(Status status, const std::string& challengeStatus) override;
 
   Block
   genChallengeRequestTLV(Status status, const std::string& challengeStatus,
-                         std::vector<std::tuple<std::string, std::string>>&& params) override;
+                         std::multimap<std::string, std::string>&& params) override;
 
   static void
-  fulfillParameters(std::vector<std::tuple<std::string, std::string>>& params,
+  fulfillParameters(std::multimap<std::string, std::string>& params,
                     KeyChain& keyChain, const Name& issuedCertName, const RequestId& requestId);
 
   // challenge parameters
diff --git a/src/identity-challenge/challenge-email.cpp b/src/identity-challenge/challenge-email.cpp
index 332ef96..8b08d82 100644
--- a/src/identity-challenge/challenge-email.cpp
+++ b/src/identity-challenge/challenge-email.cpp
@@ -103,18 +103,18 @@
 }
 
 // For Client
-std::vector<std::tuple<std::string, std::string>>
+std::multimap<std::string, std::string>
 ChallengeEmail::getRequestedParameterList(Status status, const std::string& challengeStatus)
 {
-  std::vector<std::tuple<std::string, std::string>> result;
+  std::multimap<std::string, std::string> result;
   if (status == Status::BEFORE_CHALLENGE && challengeStatus == "") {
-    result.push_back(std::make_tuple(PARAMETER_KEY_EMAIL, "Please input your email address"));
+    result.emplace(PARAMETER_KEY_EMAIL, "Please input your email address");
   }
   else if (status == Status::CHALLENGE && challengeStatus == NEED_CODE) {
-    result.push_back(std::make_tuple(PARAMETER_KEY_CODE, "Please input your verification code"));
+    result.emplace(PARAMETER_KEY_CODE, "Please input your verification code");
   }
   else if (status == Status::CHALLENGE && challengeStatus == WRONG_CODE) {
-    result.push_back(std::make_tuple(PARAMETER_KEY_CODE, "Incorrect code, please try again"));
+    result.emplace(PARAMETER_KEY_CODE, "Incorrect code, please try again");
   }
   else {
     NDN_THROW(std::runtime_error("Unexpected status or challenge status."));
@@ -124,24 +124,24 @@
 
 Block
 ChallengeEmail::genChallengeRequestTLV(Status status, const std::string& challengeStatus,
-                                       std::vector<std::tuple<std::string, std::string>>&& params)
+                                       std::multimap<std::string, std::string>&& params)
 {
   Block request(tlv::EncryptedPayload);
   if (status == Status::BEFORE_CHALLENGE) {
-    if (params.size() != 1 || std::get<0>(params[0]) != PARAMETER_KEY_EMAIL) {
+    if (params.size() != 1 || params.find(PARAMETER_KEY_EMAIL) == params.end()) {
       NDN_THROW(std::runtime_error("Wrong parameter provided."));
     }
     request.push_back(makeStringBlock(tlv::SelectedChallenge, CHALLENGE_TYPE));
     request.push_back(makeStringBlock(tlv::ParameterKey, PARAMETER_KEY_EMAIL));
-    request.push_back(makeStringBlock(tlv::ParameterValue, std::get<1>(params[0])));
+    request.push_back(makeStringBlock(tlv::ParameterValue, params.find(PARAMETER_KEY_EMAIL)->second));
   }
   else if (status == Status::CHALLENGE && (challengeStatus == NEED_CODE || challengeStatus == WRONG_CODE)) {
-    if (params.size() != 1 || std::get<0>(params[0]) != PARAMETER_KEY_CODE) {
+    if (params.size() != 1 || params.find(PARAMETER_KEY_CODE) == params.end()) {
       NDN_THROW(std::runtime_error("Wrong parameter provided."));
     }
     request.push_back(makeStringBlock(tlv::SelectedChallenge, CHALLENGE_TYPE));
     request.push_back(makeStringBlock(tlv::ParameterKey, PARAMETER_KEY_CODE));
-    request.push_back(makeStringBlock(tlv::ParameterValue, std::get<1>(params[0])));
+    request.push_back(makeStringBlock(tlv::ParameterValue, params.find(PARAMETER_KEY_CODE)->second));
   }
   else {
     NDN_THROW(std::runtime_error("Unexpected status or challenge status."));
diff --git a/src/identity-challenge/challenge-email.hpp b/src/identity-challenge/challenge-email.hpp
index 9dbcedd..c005b7e 100644
--- a/src/identity-challenge/challenge-email.hpp
+++ b/src/identity-challenge/challenge-email.hpp
@@ -60,12 +60,12 @@
   handleChallengeRequest(const Block& params, ca::RequestState& request) override;
 
   // For Client
-  std::vector<std::tuple<std::string, std::string>>
+  std::multimap<std::string, std::string>
   getRequestedParameterList(Status status, const std::string& challengeStatus) override;
 
   Block
   genChallengeRequestTLV(Status status, const std::string& challengeStatus,
-                         std::vector<std::tuple<std::string, std::string>>&& params) override;
+                         std::multimap<std::string, std::string>&& params) override;
 
   // challenge status
   static const std::string NEED_CODE;
diff --git a/src/identity-challenge/challenge-module.hpp b/src/identity-challenge/challenge-module.hpp
index 1e2ca81..02e5027 100644
--- a/src/identity-challenge/challenge-module.hpp
+++ b/src/identity-challenge/challenge-module.hpp
@@ -54,12 +54,12 @@
   handleChallengeRequest(const Block& params, ca::RequestState& request) = 0;
 
   // For Client
-  virtual std::vector<std::tuple<std::string, std::string>>
+  virtual std::multimap<std::string, std::string>
   getRequestedParameterList(Status status, const std::string& challengeStatus) = 0;
 
   virtual Block
   genChallengeRequestTLV(Status status, const std::string& challengeStatus,
-                         std::vector<std::tuple<std::string, std::string>>&& params) = 0;
+                         std::multimap<std::string, std::string>&& params) = 0;
 
   // helpers
   static std::string
diff --git a/src/identity-challenge/challenge-pin.cpp b/src/identity-challenge/challenge-pin.cpp
index 34b987d..1ae6753 100644
--- a/src/identity-challenge/challenge-pin.cpp
+++ b/src/identity-challenge/challenge-pin.cpp
@@ -84,18 +84,18 @@
 }
 
 // For Client
-std::vector<std::tuple<std::string, std::string>>
+std::multimap<std::string, std::string>
 ChallengePin::getRequestedParameterList(Status status, const std::string& challengeStatus)
 {
-  std::vector<std::tuple<std::string, std::string>> result;
+  std::multimap<std::string, std::string> result;
   if (status == Status::BEFORE_CHALLENGE) {
     // do nothing
   }
   else if (status == Status::CHALLENGE && challengeStatus == NEED_CODE) {
-    result.push_back(std::make_tuple(PARAMETER_KEY_CODE, "Please input your PIN code"));
+    result.emplace(PARAMETER_KEY_CODE, "Please input your PIN code");
   }
   else if (status == Status::CHALLENGE && challengeStatus == WRONG_CODE) {
-    result.push_back(std::make_tuple(PARAMETER_KEY_CODE, "Incorrect PIN code, please try again"));
+    result.emplace(PARAMETER_KEY_CODE, "Incorrect PIN code, please try again");
   }
   else {
     NDN_THROW(std::runtime_error("Unexpected status or challenge status."));
@@ -105,19 +105,19 @@
 
 Block
 ChallengePin::genChallengeRequestTLV(Status status, const std::string& challengeStatus,
-                                     std::vector<std::tuple<std::string, std::string>>&& params)
+                                     std::multimap<std::string, std::string>&& params)
 {
   Block request(tlv::EncryptedPayload);
   if (status == Status::BEFORE_CHALLENGE) {
     request.push_back(makeStringBlock(tlv::SelectedChallenge, CHALLENGE_TYPE));
   }
   else if (status == Status::CHALLENGE && (challengeStatus == NEED_CODE || challengeStatus == WRONG_CODE)) {
-    if (params.size() != 1 || std::get<0>(params[0]) != PARAMETER_KEY_CODE) {
+    if (params.size() != 1 || params.find(PARAMETER_KEY_CODE) == params.end()) {
       NDN_THROW(std::runtime_error("Wrong parameter provided."));
     }
     request.push_back(makeStringBlock(tlv::SelectedChallenge, CHALLENGE_TYPE));
     request.push_back(makeStringBlock(tlv::ParameterKey, PARAMETER_KEY_CODE));
-    request.push_back(makeStringBlock(tlv::ParameterValue, std::get<1>(params[0])));
+    request.push_back(makeStringBlock(tlv::ParameterValue, params.find(PARAMETER_KEY_CODE)->second));
   }
   else {
     NDN_THROW(std::runtime_error("Unexpected status or challenge status."));
diff --git a/src/identity-challenge/challenge-pin.hpp b/src/identity-challenge/challenge-pin.hpp
index 10b23d4..757870d 100644
--- a/src/identity-challenge/challenge-pin.hpp
+++ b/src/identity-challenge/challenge-pin.hpp
@@ -55,12 +55,12 @@
   handleChallengeRequest(const Block& params, ca::RequestState& request) override;
 
   // For Client
-  std::vector<std::tuple<std::string, std::string>>
+  std::multimap<std::string, std::string>
   getRequestedParameterList(Status status, const std::string& challengeStatus) override;
 
   Block
   genChallengeRequestTLV(Status status, const std::string& challengeStatus,
-                         std::vector<std::tuple<std::string, std::string>>&& params) override;
+                         std::multimap<std::string, std::string>&& params) override;
 
   // challenge status
   static const std::string NEED_CODE;