2 * Copyright (c) 2015-2017 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
16 #include "internal-encryption.h"
17 #include "rmi/common.h"
21 InternalEncryptionClient::InternalEncryptionClient(RmiClientPtr& ctx) :
26 InternalEncryptionClient::~InternalEncryptionClient()
30 int InternalEncryptionClient::setMountPassword(const std::string& password)
33 return context->methodCall<int>("InternalEncryptionServer::setMountPassword", password);
34 } catch (runtime::Exception& e) {
35 return error::Unknown;
39 int InternalEncryptionClient::mount()
42 return context->methodCall<int>("InternalEncryptionServer::mount");
43 } catch (runtime::Exception& e) {
44 return error::Unknown;
48 int InternalEncryptionClient::umount()
51 return context->methodCall<int>("InternalEncryptionServer::umount");
52 } catch (runtime::Exception& e) {
53 return error::Unknown;
57 int InternalEncryptionClient::encrypt(const std::string& password, unsigned int options)
60 return context->methodCall<int>("InternalEncryptionServer::encrypt", password, options);
61 } catch (runtime::Exception& e) {
62 return error::Unknown;
66 int InternalEncryptionClient::decrypt(const std::string& password)
69 return context->methodCall<int>("InternalEncryptionServer::decrypt", password);
70 } catch (runtime::Exception& e) {
71 return error::Unknown;
75 int InternalEncryptionClient::recovery()
78 return context->methodCall<int>("InternalEncryptionServer::recovery");
79 } catch (runtime::Exception& e) {
80 return error::Unknown;
84 int InternalEncryptionClient::isPasswordInitialized()
87 return context->methodCall<int>("InternalEncryptionServer::isPasswordInitialized");
88 } catch (runtime::Exception& e) {
89 return error::Unknown;
93 int InternalEncryptionClient::initPassword(const std::string& password)
96 return context->methodCall<int>("InternalEncryptionServer::initPassword",
98 } catch (runtime::Exception& e) {
99 return error::Unknown;
103 int InternalEncryptionClient::cleanPassword(const std::string& password)
106 return context->methodCall<int>("InternalEncryptionServer::cleanPassword",
108 } catch (runtime::Exception& e) {
109 return error::Unknown;
113 int InternalEncryptionClient::changePassword(const std::string& oldPassword,
114 const std::string& newPassword)
117 return context->methodCall<int>("InternalEncryptionServer::changePassword",
118 oldPassword, newPassword);
119 } catch (runtime::Exception& e) {
120 return error::Unknown;
124 int InternalEncryptionClient::verifyPassword(const std::string& password)
127 return context->methodCall<int>("InternalEncryptionServer::verifyPassword",
129 } catch (runtime::Exception& e) {
130 return error::Unknown;
134 int InternalEncryptionClient::getState()
137 return context->methodCall<int>("InternalEncryptionServer::getState");
138 } catch (runtime::Exception& e) {
139 return error::Unknown;
143 unsigned int InternalEncryptionClient::getSupportedOptions()
146 return context->methodCall<unsigned int>("InternalEncryptionServer::getSupportedOptions");
147 } catch (runtime::Exception& e) {
148 return error::Unknown;