summaryrefslogtreecommitdiff
path: root/src/vcore/SignatureData.h
blob: b3677d4db9b9fecfed60b24898e543882f028dd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
/*
 * @file        SignatureData.h
 * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
 * @version     1.0
 * @brief       SignatureData is used to storage data parsed from digsig file.
 */
#ifndef _SIGNATUREDATA_H_
#define _SIGNATUREDATA_H_

#include <list>
#include <set>
#include <map>
#include <string>

#include <vcore/Certificate.h>
#include <vcore/CertStoreType.h>

namespace ValidationCore {

enum SignatureType {
	AUTHOR = -1,
	DISTRIBUTOR1 = 1,
	DISTRIBUTOR2 = 2
}; // Distributor type can be increase, do not use enum class.

class SignatureData;

typedef std::set<std::string> ReferenceSet;
typedef std::set<std::string> ProxySet;
typedef std::list<std::string> ObjectList;
typedef std::map<int, SignatureData> SignatureDataMap;

class SignatureData {
public:
	SignatureData();
	SignatureData(const std::string &fileName, int fileNumber);

	virtual ~SignatureData();

	typedef std::list<std::string> IMEIList;
	typedef std::list<std::string> MEIDList;

	void setReference(const ReferenceSet &referenceSet);
	void setSortedCertificateList(const CertificateList &list);
	void setStorageType(const CertStoreId::Set &storeIdSet);
	bool isCertListSorted() const;

	const ReferenceSet &getReferenceSet() const;
	CertificateList getCertList() const;
	ObjectList getObjectList() const;
	bool containObjectReference(const std::string &ref) const;
	bool isAuthorSignature() const;
	int getSignatureNumber() const;
	std::string getSignatureFileName() const;
	std::string getRoleURI() const;
	std::string getProfileURI() const;
	const CertStoreId::Set &getStorageType() const;
	CertStoreId::Type getVisibilityLevel() const;
	const IMEIList &getIMEIList() const;
	const MEIDList &getMEIDList() const;
	CertificatePtr getEndEntityCertificatePtr() const;
	CertificatePtr getRootCaCertificatePtr() const;

	friend class SignatureReader;

private:
	ReferenceSet m_referenceSet;
	ProxySet m_proxySet;
	CertificateList m_certList;

	//TargetRestriction
	IMEIList m_imeiList;
	MEIDList m_meidList;

	/*
	 * This number is taken from distributor signature file name.
	 * Author signature do not contain any number on the file name.
	 * Author signature should have signature number equal to -1.
	 */
	int m_signatureNumber;
	std::string m_fileName;
	std::string m_roleURI;
	std::string m_profileURI;
	std::string m_identifier;
	ObjectList m_objectList;
	CertStoreId::Set m_storeIdSet;
	bool m_certificateSorted;
};

} // ValidationCore

#endif