Fix internal tests
[platform/core/security/cert-svc.git] / vcore / vcore / SignatureData.h
1 /*
2  * Copyright (c) 2011 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        SignatureData.h
18  * @author      Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19  * @version     1.0
20  * @brief       SignatureData is used to storage data parsed from digsig file.
21  */
22 #ifndef _SIGNATUREDATA_H_
23 #define _SIGNATUREDATA_H_
24
25 #include <list>
26 #include <set>
27 #include <string>
28
29 #include <vcore/Certificate.h>
30 #include <vcore/CertStoreType.h>
31
32 namespace ValidationCore {
33
34 typedef std::set<std::string> ReferenceSet;
35 typedef std::list<std::string> ObjectList;
36
37 class SignatureData {
38 public:
39     SignatureData();
40     SignatureData(const std::string &fileName, int fileNumber);
41
42     virtual ~SignatureData();
43
44     typedef std::list<std::string> IMEIList;
45     typedef std::list<std::string> MEIDList;
46
47     void setReference(const ReferenceSet &referenceSet);
48     void setSortedCertificateList(const CertificateList &list);
49     void setStorageType(const CertStoreId::Set &storeIdSet);
50
51     const ReferenceSet& getReferenceSet() const;
52     CertificateList getCertList() const;
53     ObjectList getObjectList() const;
54     bool containObjectReference(const std::string &ref) const;
55     bool isAuthorSignature() const;
56     int getSignatureNumber() const;
57     std::string getSignatureFileName() const;
58     std::string getRoleURI() const;
59     std::string getProfileURI() const;
60     const CertStoreId::Set& getStorageType() const;
61     CertStoreId::Type getVisibilityLevel() const;
62     const IMEIList& getIMEIList() const;
63     const MEIDList& getMEIDList() const;
64     CertificatePtr getEndEntityCertificatePtr() const;
65     CertificatePtr getRootCaCertificatePtr() const;
66
67     friend class SignatureReader;
68
69 private:
70     ReferenceSet m_referenceSet;
71     CertificateList m_certList;
72
73     //TargetRestriction
74     IMEIList m_imeiList;
75     MEIDList m_meidList;
76
77     /*
78      * This number is taken from distributor signature file name.
79      * Author signature do not contain any number on the file name.
80      * Author signature should have signature number equal to -1.
81      */
82     int m_signatureNumber;
83     std::string m_fileName;
84     std::string m_roleURI;
85     std::string m_profileURI;
86     std::string m_identifier;
87     ObjectList m_objectList;
88     CertStoreId::Set m_storeIdSet;
89     bool m_certificateSorted;
90 };
91
92 typedef std::set<SignatureData> SignatureDataSet;
93
94 } // ValidationCore
95
96 #endif