2 * Copyright (c) 2015 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 #include "internal-encryption.h"
21 #include "rmi/internal-encryption.h"
25 int ode_internal_encryption_mount(const char* password)
27 RET_ON_FAILURE(password, ODE_ERROR_INVALID_PARAMETER);
30 RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED);
31 InternalEncryption internal = client.createInterface<InternalEncryption>();
33 return internal.mount(password);
36 int ode_internal_encryption_umount()
39 RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED);
40 InternalEncryption internal = client.createInterface<InternalEncryption>();
42 return internal.umount();
45 int ode_internal_encryption_encrypt(const char* password)
47 RET_ON_FAILURE(password, ODE_ERROR_INVALID_PARAMETER);
50 RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED);
51 InternalEncryption internal = client.createInterface<InternalEncryption>();
53 return internal.encrypt(password);
56 int ode_internal_encryption_decrypt(const char* password)
58 RET_ON_FAILURE(password, ODE_ERROR_INVALID_PARAMETER);
61 RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED);
62 InternalEncryption internal = client.createInterface<InternalEncryption>();
64 return internal.decrypt(password);
67 int ode_internal_encryption_change_password(const char* old_password,
68 const char* new_password)
70 RET_ON_FAILURE(old_password, ODE_ERROR_INVALID_PARAMETER);
71 RET_ON_FAILURE(new_password, ODE_ERROR_INVALID_PARAMETER);
74 RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED);
75 InternalEncryption internal = client.createInterface<InternalEncryption>();
77 return internal.changePassword(old_password, new_password);
80 int ode_internal_encryption_get_state(int* state)
82 RET_ON_FAILURE(state, ODE_ERROR_INVALID_PARAMETER);
85 RET_ON_FAILURE(client.connect() == 0, ODE_ERROR_CONNECTION_REFUSED);
86 InternalEncryption internal = client.createInterface<InternalEncryption>();
87 int ret = internal.getState();
89 RET_ON_FAILURE(ret < 0, ODE_ERROR_INVALID_PARAMETER);
92 return ODE_ERROR_NONE;