Replace RawData with RawBuffer.
[platform/core/security/key-manager.git] / src / manager / client / client-key.cpp
1 /* Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd All Rights Reserved
2  *
3  *  Licensed under the Apache License, Version 2.0 (the "License");
4  *  you may not use this file except in compliance with the License.
5  *  You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  *  Unless required by applicable law or agreed to in writing, software
10  *  distributed under the License is distributed on an "AS IS" BASIS,
11  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  *  See the License for the specific language governing permissions and
13  *  limitations under the License
14  *
15  *
16  * @file        client-key.cpp
17  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
18  * @version     1.0
19  * @brief       Key - api implementation.
20  */
21 #include <ckm/ckm-type.h>
22 #include <ckm/key-manager.h>
23
24 #include <client-key-impl.h>
25
26 namespace CKM {
27
28 Key::Key()
29   : m_impl(new KeyImpl())
30 {}
31
32 Key::Key(
33     const RawBuffer &rawData,
34     KeyType type,
35     const RawBuffer &password)
36   : m_impl(new KeyImpl(rawData, type, password))
37 {}
38
39 Key::Key(const Key &second) {
40     m_impl = second.m_impl;
41 }
42
43 Key& Key::operator=(const Key &second) {
44     m_impl = second.m_impl;
45     return *this;
46 }
47
48 Key::~Key(){
49 }
50
51 bool Key::empty() const {
52     if (m_impl)
53         return m_impl->empty();
54     return true;
55 }
56
57 KeyType Key::getType() const {
58     if (m_impl)
59         return m_impl->getType();
60     return KeyType::KEY_NONE;
61 }
62
63 RawBuffer Key::getKey() const {
64     if (m_impl)
65         return m_impl->getKey();
66     return RawBuffer();
67 }
68
69 KeyImpl* Key::getImpl() const {
70     if (m_impl)
71         return m_impl.get();
72     return NULL;
73 };
74
75
76 } // namespace CKM
77