Added exceptions to DBCryptoModule and DBCMAlgType type for algorithmType
[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::string Alias;
32 typedef std::vector<Alias> AliasVector;
33
34 enum class KeyType : int {
35     KEY_NONE,
36     KEY_RSA_PUBLIC,
37     KEY_RSA_PRIVATE,
38     KEY_ECDSA_PUBLIC,
39     KEY_ECDSA_PRIVATE,
40     KEY_AES
41 };
42
43 enum class DataFormat : int {
44     FORM_DER_BASE64,
45     FORM_DER,
46     FORM_PEM
47 };
48
49 enum class ElipticCurve : int {
50     prime192v1,
51     prime256v1,
52     secp384r1
53 };
54
55 struct Policy {
56     Policy(const std::string &pass = std::string(), bool extract = true, bool rest = false)
57       : password(pass)
58       , extractable(extract)
59       , restricted(rest)
60     {}
61     virtual ~Policy(){}
62     std::string password;  // byte array used to encrypt data inside CKM
63     bool extractable;  // if true key may be extracted from storage
64     bool restricted;   // if true only key owner may see data
65 };
66
67 // Added by Dongsun Lee
68 enum class HashAlgorithm : int {
69     SHA1,
70     SHA256,
71     SHA384,
72     SHA512
73 };
74
75 // Added by Dongsun Lee
76 enum class RSAPaddingAlgorithm : int {
77     XRSA_PKCS1_PADDING,
78 //  XRSA_SSLV23_PADDING, // not supported
79 //  XRSA_NO_PADDING, // not supported
80 //  XRSA_PKCS1_OAEP_PADDING, // not supported
81     XRSA_X931_PADDING
82 };
83
84 enum class DBCMAlgType : int {
85     NONE,
86     AES_CBC_256,
87     COUNT
88 };
89
90 // Internal types
91 class KeyImpl;
92 class CertificateImpl;
93
94 } // namespace CKM
95