2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file SignatureData.cpp
18 * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
20 * @brief SignatureData is used to storage data parsed from digsig file.
22 #ifndef _SIGNATUREDATA_H_
23 #define _SIGNATUREDATA_H_
29 #include <dpl/log/log.h>
30 #include <dpl/noncopyable.h>
31 #include <dpl/string.h>
33 #include "Certificate.h"
34 #include "CertStoreType.h"
35 #include "ValidatorCommon.h"
37 /* TODO this class should not depend from OCSP headers */
38 #include "OCSPCertMgrUtil.h"
40 namespace ValidationCore {
46 m_signatureNumber(-1),
47 m_certificateSorted(false)
51 SignatureData(std::string fileName,
53 m_signatureNumber(fileNumber),
55 m_certificateSorted(false)
59 virtual ~SignatureData()
62 typedef std::list<std::string> IMEIList;
63 typedef std::list<std::string> MEIDList;
65 const ReferenceSet& getReferenceSet() const
67 return m_referenceSet;
70 void setReference(const ReferenceSet &referenceSet)
72 m_referenceSet = referenceSet;
75 CertificateList getCertList(void) const
80 void setSortedCertificateList(const CertificateList &list)
83 m_certificateSorted = true;
86 bool isAuthorSignature(void) const
88 return m_signatureNumber == -1;
91 std::string getSignatureFileName(void) const
96 int getSignatureNumber() const
98 return m_signatureNumber;
101 std::string getRoleURI() const
106 std::string getProfileURI() const
111 bool containObjectReference(const std::string &ref) const
113 std::string rName = "#";
115 return m_referenceSet.end() != m_referenceSet.find(rName);
118 ObjectList getObjectList() const
123 void setStorageType(const CertStoreId::Set &storeIdSet)
125 m_storeIdSet = storeIdSet;
128 const CertStoreId::Set& getStorageType(void) const
133 const IMEIList& getIMEIList() const
138 const MEIDList& getMEIDList() const
143 CertificatePtr getEndEntityCertificatePtr() const
145 if (m_certificateSorted) {
146 return m_certList.front();
148 return CertificatePtr();
151 CertificatePtr getRootCaCertificatePtr() const
153 if (m_certificateSorted) {
154 return m_certList.back();
156 return CertificatePtr();
159 friend class SignatureReader;
161 ReferenceSet m_referenceSet;
162 CertificateList m_certList;
169 * This number is taken from distributor signature file name.
170 * Author signature do not contain any number on the file name.
171 * Author signature should have signature number equal to -1.
173 int m_signatureNumber;
174 std::string m_fileName;
175 std::string m_roleURI;
176 std::string m_profileURI;
177 std::string m_identifier;
178 ObjectList m_objectList;
179 CertStoreId::Set m_storeIdSet;
180 bool m_certificateSorted;
183 typedef std::set<SignatureData> SignatureDataSet;