Add Internal Password popup to ode-app for temporary
[platform/core/security/ode.git] / tools / apps / ode / src / password / password.c
old mode 100644 (file)
new mode 100755 (executable)
index abe5ade..38f19db
@@ -17,6 +17,7 @@
  */
 
 #include <ode/external-encryption.h>
+#include <ode/internal-encryption.h>
 #include "ode-password.h"
 
 static popup_data_s popup_data = {0,};
@@ -107,6 +108,27 @@ void password_result_callback(popup_data_s *data, const char *result)
                        return;
                }
                break;
+       /* for temporary start */
+       case INTERNAL_ENCRYPT_PASSWORD:
+               ret = ode_internal_encryption_init_password(data->entry_data);
+               if (ret != ODE_ERROR_NONE) {
+                       dlog_print(DLOG_ERROR, LOG_TAG, "failed to create internal data");
+                       return;
+               }
+               ret = ode_internal_encryption_encrypt(data->entry_data, ad->device_info.device_option);
+               if (ret != 0) {
+                       dlog_print(DLOG_DEBUG, LOG_TAG, "failed to encrypt internal storage");
+                       return;
+               }
+               break;
+       case INTERNAL_DECRYPT_PASSWORD:
+               ret = ode_internal_encryption_decrypt(data->entry_data);
+               if (ret != 0) {
+                       dlog_print(DLOG_DEBUG, LOG_TAG, "failed to decrypt internal storage");
+                       return;
+               }
+               break;
+       /* for temporary end */
        default:
                break;
        }