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.
19 * @file CertificateCacheDAO.h
20 * @author Tomasz Swierczek (t.swierczek@samsung.com)
22 * @brief Header file for class managing CRL and OCSP cached responses
25 #ifndef _WRT_SRC_CONFIGURATION_CERTIFICATE_CACHE_DAO_H_
26 #define _WRT_SRC_CONFIGURATION_CERTIFICATE_CACHE_DAO_H_
31 #include <dpl/exception.h>
33 #include "VerificationStatus.h"
35 namespace ValidationCore {
37 struct OCSPCachedStatus
39 std::string cert_chain;
40 VerificationStatus ocsp_status;
41 bool end_entity_check;
42 time_t next_update_time;
45 typedef std::list<OCSPCachedStatus> OCSPCachedStatusList;
49 std::string distribution_point;
51 time_t next_update_time;
54 typedef std::list<CRLCachedData> CRLCachedDataList;
56 class CertificateCacheDAO {
61 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
62 DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
67 static void setOCSPStatus(const std::string& cert_chain,
68 VerificationStatus ocsp_status,
69 bool end_entity_check,
70 time_t next_update_time);
73 * fill cert_chain and end_entity_check in cached_status
74 * returns true iff cached status found without errors
76 static bool getOCSPStatus(OCSPCachedStatus* cached_status);
77 static void getOCSPStatusList(OCSPCachedStatusList* cached_status_list);
81 static void setCRLResponse(const std::string& distribution_point,
82 const std::string& crl_body,
83 time_t next_update_time);
86 * fill distribution_point
87 * returns true iff cached list for dist. point found without errors
89 static bool getCRLResponse(CRLCachedData* cached_data);
90 static void getCRLResponseList(CRLCachedDataList* cached_data_list);
93 // clears CRL and OCSP cached data
94 static void clearCertificateCache();
98 static VerificationStatus intToVerificationStatus(int p);
100 CertificateCacheDAO()
105 } // namespace ValidationCore
107 #endif /* _WRT_SRC_CONFIGURATION_CERTIFICATE_CACHE_DAO_H_ */