2 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Bumjin Im <bj.im@samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
19 * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
20 * @author Zofia Abramowska (z.abramowska@samsung.com)
22 * @brief List of all protocols supported by Central Key Manager.
25 #include <protocols.h>
27 #include <dpl/serialization.h>
31 char const * const SERVICE_SOCKET_ECHO = "/tmp/.central-ckm-manager-echo.sock";
32 char const * const SERVICE_SOCKET_CKM_CONTROL = "/tmp/.central-ckm-manager-api-control.sock";
33 char const * const SERVICE_SOCKET_CKM_STORAGE = "/tmp/.central-ckm-manager-api-storage.sock";
35 DBDataType toDBDataType(KeyType key) {
37 case KeyType::KEY_RSA_PUBLIC: return DBDataType::KEY_RSA_PUBLIC;
38 case KeyType::KEY_RSA_PRIVATE: return DBDataType::KEY_RSA_PRIVATE;
39 case KeyType::KEY_ECDSA_PUBLIC: return DBDataType::KEY_ECDSA_PUBLIC;
40 case KeyType::KEY_ECDSA_PRIVATE: return DBDataType::KEY_ECDSA_PRIVATE;
41 case KeyType::KEY_AES: return DBDataType::KEY_AES;
48 KeyType toKeyType(DBDataType dbtype) {
50 case DBDataType::KEY_RSA_PUBLIC: return KeyType::KEY_RSA_PUBLIC;
51 case DBDataType::KEY_RSA_PRIVATE: return KeyType::KEY_RSA_PRIVATE;
52 case DBDataType::KEY_ECDSA_PRIVATE: return KeyType::KEY_ECDSA_PRIVATE;
53 case DBDataType::KEY_ECDSA_PUBLIC: return KeyType::KEY_ECDSA_PUBLIC;
54 case DBDataType::KEY_AES: return KeyType::KEY_AES;
61 PolicySerializable::PolicySerializable()
65 PolicySerializable::PolicySerializable(const Policy &policy)
69 PolicySerializable::PolicySerializable(IStream &stream) {
70 Deserialization::Deserialize(stream, password);
71 Deserialization::Deserialize(stream, extractable);
72 Deserialization::Deserialize(stream, restricted);
75 void PolicySerializable::Serialize(IStream &stream) const {
76 Serialization::Serialize(stream, password);
77 Serialization::Serialize(stream, extractable);
78 Serialization::Serialize(stream, restricted);