Fix SVACE defects
[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() :
34                 Token(),
35                 exportable(0),
36                 algorithmType(DBCMAlgType::NONE),
37                 encryptionScheme(0),
38                 dataSize(0) {}
39
40         Row(Token token, const Name &pName, const Label &pLabel, int pExportable) :
41                 Token(std::move(token)),
42                 name(pName),
43                 ownerLabel(pLabel),
44                 exportable(pExportable),
45                 algorithmType(DBCMAlgType::NONE),
46                 encryptionScheme(0),
47                 dataSize(data.size()) {}
48
49         Name name;
50         Label ownerLabel;
51         int exportable = 0;
52         DBCMAlgType algorithmType = DBCMAlgType::NONE; // Row data encryption algorithm
53         int encryptionScheme = 0;   // for example: (ENCR_BASE64 | ENCR_PASSWORD)
54         RawBuffer iv;               // encoded in base64
55         int dataSize = 0;           // size of information without hash and padding
56         RawBuffer tag;              // tag for Aes Gcm algorithm
57 };
58
59 using RowVector = std::vector<Row>;
60
61 } // namespace DB
62 } // namespace CKM
63