AES key creation API 95/39295/5
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 7 Apr 2015 08:36:24 +0000 (10:36 +0200)
committerMaciej J. Karpiuk <m.karpiuk2@samsung.com>
Tue, 9 Jun 2015 12:01:36 +0000 (14:01 +0200)
[Issue#] N/A
[Feature] API allowing creation of AES key in key-manager database
[Problem] N/A
[Cause] N/A
[Solution] N/A

[Verification] Successfull compilation. Run tests.

Change-Id: I3ec358ce4a58afb657afaf110ca81bacea7dcd10

src/include/ckm/ckm-manager-async.h
src/include/ckm/ckm-manager.h
src/include/ckmc/ckmc-manager.h
src/manager/client-async/client-manager-async.cpp
src/manager/client-capi/ckmc-manager.cpp
src/manager/client/client-manager-impl.cpp
src/manager/client/client-manager-impl.h

index 21f8b64..9a743f5 100644 (file)
@@ -142,6 +142,11 @@ public:
             const Alias& publicKeyAlias,
             const Policy& policyPrivateKey = Policy(),
             const Policy& policyPublicKey = Policy());
+    void createKeyAES(
+            const ObserverPtr& observer,
+            int size,
+            const Alias &keyAlias,
+            const Policy &policyKey = Policy());
 
     void getCertificateChain(
             const ObserverPtr& observer,
index 6cb7ec3..920953b 100644 (file)
@@ -95,6 +95,11 @@ public:
         const Policy &policyPrivateKey = Policy(),
         const Policy &policyPublicKey = Policy()) = 0;
 
+    virtual int createKeyAES(
+        const int size,              // size in bits [128, 192, 256]
+        const Alias &keyAlias,
+        const Policy &policyKey = Policy()) = 0;
+
     virtual int getCertificateChain(
         const CertificateShPtr &certificate,
         const CertificateShPtrVector &untrustedCertificates,
index 7210026..9d3cae0 100644 (file)
@@ -705,6 +705,42 @@ int ckmc_create_key_pair_ecdsa(const ckmc_ec_type_e type,
                                const ckmc_policy_s policy_public_key);
 
 /**
+ * @brief Creates AES key and stores it inside key manager based on the policy.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/keymanager
+ *
+ * @remarks If password in policy is provided, the key is additionally encrypted with the password
+ *          in policy.
+ *
+ * @param[in] size                The size of key strength to be created. \n
+ *                                @c 128, @c 192 and @c 256 are supported.
+ * @param[in] key_alias           The name of key to be stored
+ * @param[in] key_policy          The policy about how to store the key securely
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #CKMC_ERROR_NONE               Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER  Input parameter is invalid
+ * @retval #CKMC_ERROR_DB_LOCKED          A user key is not loaded in memory (a user is not logged
+ *                                        in)
+ * @retval #CKMC_ERROR_DB_ALIAS_EXISTS    Alias already exists
+ * @retval #CKMC_ERROR_DB_ERROR           Failed due to other DB transaction unexpectedly
+ * @retval #CKMC_ERROR_PERMISSION_DENIED  Failed to access key manager
+ *
+ * @pre User is already logged in and the user key is already loaded into memory in plain text form.
+ *
+ * @see ckmc_create_key_pair_rsa()
+ * @see ckmc_create_key_pair_dsa()
+ * @see ckmc_create_key_pair_ecdsa()
+ */
+int ckmc_create_key_aes(const size_t size,
+                        const char *key_alias,
+                        const ckmc_policy_s key_policy);
+
+/**
  * @brief Creates a signature on a given message using a private key and returns the signature.
  *
  * @since_tizen 2.3
index 6bbabfb..8d50723 100644 (file)
@@ -184,6 +184,13 @@ void ManagerAsync::createKeyPairECDSA(const ObserverPtr& observer,
                           policyPublicKey);
 }
 
+void ManagerAsync::createKeyAES(const ObserverPtr& /*observer*/,
+                                int /*size*/,
+                                const Alias &/*keyAlias*/,
+                                const Policy &/*policyKey*/)
+{
+}
+
 void ManagerAsync::getCertificateChain(const ObserverPtr& observer,
                                        const CertificateShPtr& certificate,
                                        const CertificateShPtrVector& untrustedCertificates,
index d9ab8d1..6f6078d 100644 (file)
@@ -602,6 +602,14 @@ int ckmc_create_key_pair_ecdsa(const ckmc_ec_type_e type,
 }
 
 KEY_MANAGER_CAPI
+int ckmc_create_key_aes(const size_t /*size*/,
+                        const char */*key_alias*/,
+                        const ckmc_policy_s /*key_policy*/)
+{
+    return 0;
+}
+
+KEY_MANAGER_CAPI
 int ckmc_create_signature(const char *private_key_alias,
                             const char *password,
                             const ckmc_raw_buffer_s message,
index 91bb263..41383bf 100644 (file)
@@ -456,6 +456,15 @@ int ManagerImpl::createKeyPairECDSA(
     return this->createKeyPair(CKM::KeyType::KEY_ECDSA_PUBLIC, static_cast<int>(type), privateKeyAlias, publicKeyAlias, policyPrivateKey, policyPublicKey);
 }
 
+int ManagerImpl::createKeyAES(
+    const int /*size*/,
+    const Alias &/*keyAlias*/,
+    const Policy &/*policyKey*/)
+{
+    return 0;
+}
+
+
 int ManagerImpl::createKeyPair(
     const KeyType key_type,
     const int     additional_param,
index e93b89c..fce5992 100644 (file)
@@ -76,6 +76,11 @@ public:
         const Policy &policyPrivateKey = Policy(),
         const Policy &policyPublicKey = Policy());
 
+    int createKeyAES(
+        const int size,              // size in bits [128, 192, 256]
+        const Alias &keyAlias,
+        const Policy &policyKey = Policy());
+
     int getCertificateChain(
         const CertificateShPtr &certificate,
         const CertificateShPtrVector &untrustedCertificates,