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
17 * @file unlock-ckm.cpp
18 * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
21 #include <ckm/ckm-control.h>
23 #include <ckm-common.h>
24 #include <tests_common.h>
26 #include <process-settings/unlock-ckm.h>
28 namespace ProcessSettings {
30 UnlockCkm::UnlockCkm(const Policy &policy)
34 void UnlockCkm::Apply() {
37 m_uid = m_policy.GetUid();
39 auto control = CKM::Control::create();
41 // Let's clean up environment.
42 // It will usually fails.
43 control->removeUserData(m_uid);
46 CKM_API_SUCCESS == (temp = control->unlockUserKey(m_uid, "DummyPassword")),
47 "Error=" << CKMErrorToString(temp));
51 void UnlockCkm::Revoke() {
53 auto control = CKM::Control::create();
55 CKM_API_SUCCESS == (temp = control->removeUserData(m_uid)),
56 "Error=" << CKMErrorToString(temp));
59 UnlockCkm::~UnlockCkm() {}
61 } // namespace ProcessSettings