2 * Copyright (c) 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 "key-client.h"
17 #include "rmi/common.h"
21 KeyClient::KeyClient(RmiClientPtr& ctx) :
26 KeyClient::~KeyClient()
30 int KeyClient::isInitialized(const std::string& device)
33 return context->methodCall<int>("KeyServer::isInitialized", device);
34 } catch (runtime::Exception& e) {
35 return error::Unknown;
39 int KeyClient::init(const std::string& device,
40 const std::string& password,
44 return context->methodCall<int>("KeyServer::init",
48 } catch (runtime::Exception& e) {
49 return error::Unknown;
53 int KeyClient::remove(const std::string& device, const std::string& password)
56 return context->methodCall<int>("KeyServer::remove", device, password);
57 } catch (runtime::Exception& e) {
58 return error::Unknown;
62 int KeyClient::changePassword(const std::string& device,
63 const std::string& curPassword,
64 const std::string& newPassword)
67 return context->methodCall<int>("KeyServer::changePassword",
71 } catch (runtime::Exception& e) {
72 return error::Unknown;
76 int KeyClient::verifyPassword(const std::string& device,
77 const std::string& password)
80 return context->methodCall<int>("KeyServer::verifyPassword",
83 } catch (runtime::Exception& e) {
84 return error::Unknown;
88 int KeyClient::storeMasterKey(const std::string& device,
89 const std::string& password)
92 return context->methodCall<int>("KeyServer::storeMasterKey",
95 } catch (runtime::Exception& e) {
96 return error::Unknown;
100 int KeyClient::removeMasterKey(const std::string& device)
103 return context->methodCall<int>("KeyServer::removeMasterKey",
105 } catch (runtime::Exception& e) {
106 return error::Unknown;