security: change enum to enum class in security-common.hpp

Change-Id: I5565c845cd57f3457c8120b11399a105fa83418d
Refs: #3083
diff --git a/src/security/key-chain.cpp b/src/security/key-chain.cpp
index e6b1ff0..8369cb1 100644
--- a/src/security/key-chain.cpp
+++ b/src/security/key-chain.cpp
@@ -533,7 +533,7 @@
   Name keyName;
   SignatureInfo sigInfo;
   std::tie(keyName, sigInfo) = prepareSignatureInfo(params);
-  return pureSign(buffer, bufferLength, keyName, DIGEST_ALGORITHM_SHA256);
+  return pureSign(buffer, bufferLength, keyName, DigestAlgorithm::SHA256);
 }
 
 Signature
@@ -550,7 +550,7 @@
   // For temporary usage, we support SHA256 only, but will support more.
   sig.setValue(m_tpm->signInTpm(buffer, bufferLength,
                                 certificate->getPublicKeyName(),
-                                DIGEST_ALGORITHM_SHA256));
+                                DigestAlgorithm::SHA256));
 
   return sig;
 }
@@ -589,15 +589,16 @@
 KeyChain::selfSign(IdentityCertificate& cert)
 {
   Name keyName = cert.getPublicKeyName();
-  if (!m_tpm->doesKeyExistInTpm(keyName, KEY_CLASS_PRIVATE))
+
+  if (!m_tpm->doesKeyExistInTpm(keyName, KeyClass::PRIVATE))
     BOOST_THROW_EXCEPTION(SecTpm::Error("Private key does not exist"));
 
   SignatureInfo sigInfo(cert.getSignature().getInfo());
   sigInfo.setKeyLocator(KeyLocator(cert.getName().getPrefix(-1)));
   sigInfo.setSignatureType(getSignatureType(cert.getPublicKeyInfo().getKeyType(),
-                                            DIGEST_ALGORITHM_SHA256));
+                                            DigestAlgorithm::SHA256));
 
-  signPacketWrapper(cert, Signature(sigInfo), keyName, DIGEST_ALGORITHM_SHA256);
+  signPacketWrapper(cert, Signature(sigInfo), keyName, DigestAlgorithm::SHA256);
 }
 
 shared_ptr<SecuredBag>
@@ -657,7 +658,7 @@
 const KeyParams&
 KeyChain::getDefaultKeyParamsForIdentity(const Name &identityName) const
 {
-  KeyType keyType = KEY_TYPE_NULL;
+  KeyType keyType = KeyType::NONE;
   try {
     keyType = m_pib->getPublicKeyType(m_pib->getDefaultKeyNameForIdentity(identityName));
   }
@@ -666,15 +667,15 @@
   }
 
   switch (keyType) {
-    case KEY_TYPE_RSA: {
+    case KeyType::RSA: {
       static RsaKeyParams defaultRsaParams;
       return defaultRsaParams;
     }
-    case KEY_TYPE_ECDSA: {
+    case KeyType::EC: {
       static EcdsaKeyParams defaultEcdsaParams;
       return defaultEcdsaParams;
     }
-    case KEY_TYPE_NULL: {
+    case KeyType::NONE: {
       return DEFAULT_KEY_PARAMS;
     }
     default:
@@ -833,9 +834,9 @@
 KeyChain::getSignatureType(KeyType keyType, DigestAlgorithm digestAlgorithm)
 {
   switch (keyType) {
-    case KEY_TYPE_RSA:
+    case KeyType::RSA:
       return tlv::SignatureSha256WithRsa;
-    case KEY_TYPE_ECDSA:
+    case KeyType::EC:
       return tlv::SignatureSha256WithEcdsa;
     default:
       BOOST_THROW_EXCEPTION(Error("Unsupported key types"));