Replace std::string with CKM::Password
[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 #include <ckm/ckm-raw-buffer.h>
28 #include <ckm/ckm-password.h>
29
30 namespace CKM {
31
32 // used to pass password and raw key data
33 typedef std::vector<RawBuffer> RawBufferVector;
34 typedef std::string Alias;
35 typedef std::vector<Alias> AliasVector;
36
37 enum class KeyType : int {
38     KEY_NONE,
39     KEY_RSA_PUBLIC,
40     KEY_RSA_PRIVATE,
41     KEY_ECDSA_PUBLIC,
42     KEY_ECDSA_PRIVATE,
43     KEY_AES
44 };
45
46 enum class DataFormat : int {
47     FORM_DER_BASE64,
48     FORM_DER,
49     FORM_PEM
50 };
51
52 enum class ElipticCurve : int {
53     prime192v1,
54     prime256v1,
55     secp384r1
56 };
57
58 enum class CertificateFieldId : int {
59     ISSUER,
60     SUBJECT
61 };
62
63 struct Policy {
64     Policy(const Password &pass = Password(), bool extract = true, bool rest = false)
65       : password(pass)
66       , extractable(extract)
67       , restricted(rest)
68     {}
69     virtual ~Policy(){}
70     Password password;  // byte array used to encrypt data inside CKM
71     bool extractable;  // if true key may be extracted from storage
72     bool restricted;   // if true only key owner may see data
73 };
74
75 // Added by Dongsun Lee
76 enum class HashAlgorithm : int {
77     SHA1,
78     SHA256,
79     SHA384,
80     SHA512
81 };
82
83 // Added by Dongsun Lee
84 enum class RSAPaddingAlgorithm : int {
85     PKCS1,
86 //  SSLV23, // not supported
87 //  NONE, // not supported
88 //  PKCS1_OAEP, // not supported
89     X931
90 };
91
92 enum class DBCMAlgType : int {
93     NONE,
94     AES_CBC_256,
95     COUNT
96 };
97
98 const char * ErrorToString(int error);
99
100 } // namespace CKM
101