97edfab5c10501f9ad603908ef55dcfa8f8e25fc
[platform/core/security/key-manager.git] / src / manager / service / db-row.h
1 /*
2  * Copyright (c) 2014 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        db-row.h
18  * @author      Zofia Abramowska (z.abramowska@samsung.com)
19  * @version     1.0
20  * @brief       OBJECT_TABLE entry enhanced with corresponding NAME_TABLE identifier
21  */
22 #pragma once
23
24 #include <vector>
25 #include <ckm/ckm-type.h>
26 #include <protocols.h>
27 #include <token.h>
28
29 namespace CKM {
30 namespace DB {
31
32 struct Row : public Token {
33         Row() = default;
34
35         Row(Token token, const Name &pName, const Label &pLabel, int pExportable) :
36                 Token(std::move(token)),
37                 name(pName),
38                 ownerLabel(pLabel),
39                 exportable(pExportable),
40                 algorithmType(DBCMAlgType::NONE),
41                 encryptionScheme(0),
42                 dataSize(data.size()) {}
43
44         Name name;
45         Label ownerLabel;
46         int exportable = 0;
47         DBCMAlgType algorithmType = DBCMAlgType::NONE; // Row data encryption algorithm
48         int encryptionScheme = 0;   // for example: (ENCR_BASE64 | ENCR_PASSWORD)
49         RawBuffer iv;               // encoded in base64
50         int dataSize = 0;           // size of information without hash and padding
51         RawBuffer tag;              // tag for Aes Gcm algorithm
52 };
53
54 using RowVector = std::vector<Row>;
55
56 } // namespace DB
57 } // namespace CKM
58