improve the robustness of ndncert library

Change-Id: Iaabc4d8f28ca27a7e7f501ebd122c5231ceb3ac0
diff --git a/src/challenge-module.cpp b/src/challenge-module.cpp
index 8c332cb..9288330 100644
--- a/src/challenge-module.cpp
+++ b/src/challenge-module.cpp
@@ -31,11 +31,19 @@
 
 ChallengeModule::~ChallengeModule() = default;
 
-unique_ptr<ChallengeModule>
-ChallengeModule::createChallengeModule(const std::string& canonicalName)
+bool
+ChallengeModule::supportChallenge(const std::string& challengeType)
 {
   ChallengeFactory& factory = getFactory();
-  auto i = factory.find(canonicalName);
+  auto i = factory.find(challengeType);
+  return i == factory.end() ? false : true;
+}
+
+unique_ptr<ChallengeModule>
+ChallengeModule::createChallengeModule(const std::string& challengeType)
+{
+  ChallengeFactory& factory = getFactory();
+  auto i = factory.find(challengeType);
   return i == factory.end() ? nullptr : i->second();
 }