2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
18 * @author Dongsun Lee (ds73.lee@samsung.com)
20 * @brief Key manupulatation.
22 #ifndef __WAE_KEY_HANDLER_H
23 #define __WAE_KEY_HANDLER_H
32 #include "web_app_enc.h"
35 #define MAX_PATH_LEN 512
37 /* functions with "_" prefix are internal static functions but declared here for testing */
38 void _remove_app_ce_from_cache(const char *pkg_id);
39 int _get_random(raw_buffer_s *rb);
40 int _get_preloaded_app_dek_file_path(const char *pkg_id, size_t size, char *path);
41 int _read_encrypted_app_dek_from_file(const char *pkg_id, raw_buffer_s **pencrypted);
42 int _write_encrypted_app_dek_to_file(const char *pkg_id, const raw_buffer_s *encrypted);
44 /* functions for interface */
45 int get_app_ce(const char *pkg_id, wae_app_type_e app_type, bool create_for_migrated_app,
46 const crypto_element_s **pce);
47 int create_app_ce(const char *pkg_id, wae_app_type_e app_type,
48 const crypto_element_s **pce);
49 int get_preloaded_app_ce(const char *pkg_id, const crypto_element_s **pce);
50 int create_preloaded_app_ce(const char *pkg_id, const crypto_element_s **pce);
51 int load_preloaded_app_deks(bool reload);
52 int remove_app_ce(const char *pkg_id, wae_app_type_e app_type);
58 #endif /* __WAE_KEY_HANDLER_H */