Move secret code generation function to ChallengeModule base class

Change-Id: I66e46be78b1b924a095ffb749a869dd7477ad005
diff --git a/src/challenge-module/challenge-pin.cpp b/src/challenge-module/challenge-pin.cpp
index 8c19c97..2dd4acf 100644
--- a/src/challenge-module/challenge-pin.cpp
+++ b/src/challenge-module/challenge-pin.cpp
@@ -50,7 +50,7 @@
   request.setStatus(NEED_CODE);
   request.setChallengeType(CHALLENGE_TYPE);
   request.setChallengeSecrets(generateStoredSecrets(time::system_clock::now(),
-                                                    generateSecureSecretCode(),
+                                                    generateSecretCode(),
                                                     m_maxAttemptTimes));
   return genResponseChallengeJson(request.getRequestId(), CHALLENGE_TYPE, NEED_CODE);
 }
@@ -149,21 +149,5 @@
   return json;
 }
 
-std::string
-ChallengePin::generateSecureSecretCode()
-{
-  uint32_t securityCode = 0;
-  do {
-    securityCode = random::generateSecureWord32();
-  }
-  while (securityCode >= 4294000000);
-  securityCode /= 4294;
-  std::string result = std::to_string(securityCode);
-  while (result.length() < 6) {
-    result = "0" + result;
-  }
-  return result;
-}
-
 } // namespace ndncert
 } // namespace ndn