libdigidocpp
Conf.cpp
Go to the documentation of this file.
1 /*
2  * libdigidocpp
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  */
19 
20 #include "Conf.h"
21 
22 #include "log.h"
23 #include "crypto/Digest.h"
24 
25 #ifndef CERTS_PATH
26 #define CERTS_PATH ""
27 #endif
28 
29 using namespace digidoc;
30 
31 Conf* Conf::INSTANCE = 0;
32 const struct Conf::OCSPConf Conf::ocsplist[] = {
33  { "ESTEID-SK", "http://ocsp.sk.ee", "ESTEID-SK OCSP RESPONDER 2005" },
34  { "ESTEID-SK 2007", "http://ocsp.sk.ee", "ESTEID-SK 2007 OCSP RESPONDER 2010" },
35  { "ESTEID-SK 2011", "http://ocsp.sk.ee", "SK OCSP RESPONDER 2011" },
36  { "EID-SK", "http://ocsp.sk.ee", "EID-SK OCSP RESPONDER" },
37  { "EID-SK 2007", "http://ocsp.sk.ee", "EID-SK 2007 OCSP RESPONDER 2010" },
38  { "EID-SK 2011", "http://ocsp.sk.ee", "SK OCSP RESPONDER 2011" },
39  { "KLASS3-SK", "http://ocsp.sk.ee", "KLASS3-SK OCSP RESPONDER 2009" },
40  { "KLASS3-SK 2010", "http://ocsp.sk.ee", "KLASS3-SK 2010 OCSP RESPONDER" },
41  { "TEST-SK", "http://www.openxades.org/cgi-bin/ocsp.cgi", "TEST-SK OCSP RESPONDER 2005" },
42  { "TEST of ESTEID-SK 2011", "http://www.openxades.org/cgi-bin/ocsp.cgi", "TEST of SK OCSP RESPONDER 2011" },
43  { "TEST of EID-SK 2011", "http://www.openxades.org/cgi-bin/ocsp.cgi", "TEST of SK OCSP RESPONDER 2011" },
44  { "TEST of KLASS3-SK 2010", "http://www.openxades.org/cgi-bin/ocsp.cgi", "TEST of SK OCSP RESPONDER 2011" },
45  { "", "", "" }
46 };
47 
49 {
50  return INSTANCE;
51 }
52 
57 void Conf::init(Conf *conf)
58 {
59  delete INSTANCE;
60  INSTANCE = conf;
61 }
62 
64 {
65  return INSTANCE ? 1 : 0;
66 }
67 
69 {
70  delete INSTANCE;
71  INSTANCE = 0;
72 }
73 
74 int Conf::getLogLevel() const { return Log::InfoType; }
75 std::string Conf::getLogFile() const { return ""; }
76 std::string Conf::getDigestUri() const { return URI_SHA256; }
77 std::string Conf::getSignatureUri() const { return URI_RSA_SHA256; }
78 std::string Conf::getManifestXsdPath() const { return "schema/OpenDocument_manifest.xsd"; }
79 std::string Conf::getXadesXsdPath() const { return "schema/XAdES.xsd"; }
80 std::string Conf::getDsigXsdPath() const { return "schema/xmldsig-core-schema.xsd"; }
81 std::string Conf::getPKCS11DriverPath() const { return PKCS11_MODULE; }
82 Conf::OCSPConf Conf::getOCSP(const std::string &issuer) const
83 {
84  for(size_t i = 0; !ocsplist[i].issuer.empty(); ++i)
85  if(ocsplist[i].issuer == issuer)
86  return ocsplist[i];
87  return Conf::OCSPConf();
88 }
89 std::string Conf::getCertStorePath() const { return CERTS_PATH; }
90 std::string Conf::getProxyHost() const { return ""; }
91 std::string Conf::getProxyPort() const { return ""; }
92 std::string Conf::getProxyUser() const { return ""; }
93 std::string Conf::getProxyPass() const { return ""; }
94 std::string Conf::getPKCS12Cert() const { return ""; }
95 std::string Conf::getPKCS12Pass() const { return ""; }
96 bool Conf::getPKCS12Disable() const { return true; }