security: Support KeyType in SecPublicInfo
Change-Id: I0c56b849cd9d659a8f6fd0a0225104ea62bbccd6
Refs: #1648
diff --git a/src/security/sec-public-info.hpp b/src/security/sec-public-info.hpp
index 29b8f64..509cd09 100644
--- a/src/security/sec-public-info.hpp
+++ b/src/security/sec-public-info.hpp
@@ -99,12 +99,26 @@
/**
* @brief Add a public key to the identity storage.
*
+ * @deprecated Use addKey instead
+ *
* @param keyName The name of the public key to be added
* @param keyType Type of the public key to be added
* @param publicKey Reference to the PublicKey object
*/
+ void
+ addPublicKey(const Name& keyName, KeyType keyType, const PublicKey& publicKey)
+ {
+ addKey(keyName, publicKey);
+ }
+
+ /**
+ * @brief Add a public key to the identity storage.
+ *
+ * @param keyName The name of the public key to be added
+ * @param publicKey Reference to the PublicKey object
+ */
virtual void
- addPublicKey(const Name& keyName, KeyType keyType, const PublicKey& publicKey) = 0;
+ addKey(const Name& keyName, const PublicKey& publicKey) = 0;
/**
* @brief Get shared pointer to PublicKey object from the identity storage
@@ -116,6 +130,18 @@
getPublicKey(const Name& keyName) = 0;
/**
+ * @brief Get the type of the queried public key
+ *
+ * @note KeyType is also available from PublicKey instance.
+ * This method is more efficient if only KeyType is needed.
+ *
+ * @param keyName The name of the requested public key
+ * @return the type of the key. If the queried key does not exist, KEY_TYPE_NULL will be returned
+ */
+ virtual KeyType
+ getPublicKeyType(const Name& keyName) = 0;
+
+ /**
* @brief Check if the specified certificate already exists
*
* @param certificateName The name of the certificate