Remove all namespaces from ckm-error.h header.
[platform/core/security/key-manager.git] / src / include / ckm / ckm-type.h
1 /*
2  *  Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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
15  *
16  *
17  * @file        ckm-type.h
18  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19  * @version     1.0
20  * @brief       Sample service implementation.
21  */
22 #pragma once
23
24 #include <string>
25 #include <vector>
26
27 namespace CKM {
28
29 // used to pass password and raw key data
30 typedef std::vector<unsigned char> RawBuffer;
31 typedef std::vector<RawBuffer> RawBufferVector;
32 typedef std::string Alias;
33 typedef std::vector<Alias> AliasVector;
34
35 enum class KeyType : int {
36     KEY_NONE,
37     KEY_RSA_PUBLIC,
38     KEY_RSA_PRIVATE,
39     KEY_ECDSA_PUBLIC,
40     KEY_ECDSA_PRIVATE,
41     KEY_AES
42 };
43
44 enum class DataFormat : int {
45     FORM_DER_BASE64,
46     FORM_DER,
47     FORM_PEM
48 };
49
50 enum class ElipticCurve : int {
51     prime192v1,
52     prime256v1,
53     secp384r1
54 };
55
56 struct Policy {
57     Policy(const std::string &pass = std::string(), bool extract = true, bool rest = false)
58       : password(pass)
59       , extractable(extract)
60       , restricted(rest)
61     {}
62     virtual ~Policy(){}
63     std::string password;  // byte array used to encrypt data inside CKM
64     bool extractable;  // if true key may be extracted from storage
65     bool restricted;   // if true only key owner may see data
66 };
67
68 // Added by Dongsun Lee
69 enum class HashAlgorithm : int {
70     SHA1,
71     SHA256,
72     SHA384,
73     SHA512
74 };
75
76 // Added by Dongsun Lee
77 enum class RSAPaddingAlgorithm : int {
78     PKCS1,
79 //  SSLV23, // not supported
80 //  NONE, // not supported
81 //  PKCS1_OAEP, // not supported
82     X931
83 };
84
85 enum class DBCMAlgType : int {
86     NONE,
87     AES_CBC_256,
88     COUNT
89 };
90
91 // Internal types
92 class GenericKey;
93 class CertificateImpl;
94
95 const char * ErrorToString(int error);
96
97 } // namespace CKM
98