Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions etc/Doxyfile.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#projectlogo > img {
width: 55px;
height: 55px;
}
2 changes: 1 addition & 1 deletion etc/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_EXTRA_STYLESHEET =
HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/etc/Doxyfile.css

# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
Expand Down
13 changes: 11 additions & 2 deletions src/Conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ using namespace std;

Conf* Conf::INSTANCE = nullptr;

/**
* @typedef digidoc::ConfCurrent
* @see digidoc::ConfV5
*/

/**
* @class digidoc::Conf
* @brief Configuration class which can reimplemented and virtual methods overloaded.
*
* @deprecated Use digidoc::ConfV5
* @see @ref parameters
*/
/**
Expand All @@ -62,7 +68,7 @@ void Conf::init(Conf *conf)

/**
* Returns libdigidoc library configuration file's (digidoc.ini) file location
* @deprecated unused
* @deprecated Unused
*/
string Conf::libdigidocConf() const { return {}; }

Expand Down Expand Up @@ -116,7 +122,7 @@ string Conf::ocsp(const string &issuer) const

/**
* Gets Certificate store location.
* @deprecated unused
* @deprecated Unused
*/
string Conf::certsPath() const { return {}; }

Expand Down Expand Up @@ -234,6 +240,7 @@ string Conf::verifyServiceUri() const { return SIVA_URL; }
* subclasses to keep binary compatibility
* https://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++#Adding_new_virtual_functions_to_leaf_classes
* @see digidoc::Conf
* @deprecated Use digidoc::ConfV5
* @see @ref parameters
*/
/**
Expand Down Expand Up @@ -263,6 +270,7 @@ X509Cert ConfV2::verifyServiceCert() const { return X509Cert(); }
* subclasses to keep binary compatibility
* https://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++#Adding_new_virtual_functions_to_leaf_classes
* @see digidoc::ConfV2
* @deprecated Use digidoc::ConfV5
* @see @ref parameters
*/
/**
Expand Down Expand Up @@ -294,6 +302,7 @@ set<string> ConfV3::OCSPTMProfiles() const { return { "1.3.6.1.4.1.10015.4.1.2"
* subclasses to keep binary compatibility
* https://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++#Adding_new_virtual_functions_to_leaf_classes
* @see digidoc::ConfV3
* @deprecated Use digidoc::ConfV5
* @see @ref parameters
*/
/**
Expand Down
6 changes: 3 additions & 3 deletions src/Container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Container::~Container() = default;
* Adds the data from an input stream (i.e. the data file contents can be read from internal memory buffer).
*
* Takes ownership std::istream *is object.
* @deprecated digidoc::Container::addDataFile(std::unique_ptr<std::istream> is, const std::string &fileName, const std::string &mediaType)
* @deprecated Use digidoc::Container::addDataFile(std::unique_ptr<std::istream> is, const std::string &fileName, const std::string &mediaType)
* @param is input stream from where data is read
* @param fileName data file name in the container
* @param mediaType MIME type of the data file, for example “text/plain” or “application/msword”
Expand Down Expand Up @@ -282,7 +282,7 @@ void Container::addAdESSignature(const std::vector<unsigned char> &signature)
/**
* Create a new container object and specify the DigiDoc container type
*
* @deprecated use Container::createPtr
* @deprecated Use Container::createPtr
* This method gives ownership of object to caller
*/
Container* Container::create(const std::string &path)
Expand Down Expand Up @@ -332,7 +332,7 @@ unsigned int Container::newSignatureId() const
*
* This method gives ownership of object to caller
*
* @deprecated use Container::openPtr
* @deprecated Use Container::openPtr
* @param path
* @throws Exception
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ std::vector<Exception::ExceptionCode> Exception::ignores {};
*
* @var digidoc::Exception::DDocError
* DDoc libdigidoc error codes bit masked
* @deprecated unused
* @deprecated Unused
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ X509Cert Signature::OCSPCertificate() const { return X509Cert(); }

/**
* Returns signed signature message imprint in OCSP response nonce.
* @deprecated use messageImprint
* @deprecated Use messageImprint()
*/
vector<unsigned char> Signature::OCSPNonce() const { return messageImprint(); }

Expand Down
63 changes: 33 additions & 30 deletions src/XmlConf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,18 @@ class XmlConfParam: public unique_ptr<A>
public:
XmlConfParam(string _name, A def = {}): name(std::move(_name)), _def(std::move(def)) {}

void setValue(const A &val, const Param::LockOptional &lock, bool global)
void setValue(const string &val, const Param::LockOptional &lock, bool global)
{
if(global && lock.present()) locked = lock.get();
if(global || !locked) operator =(val);
if(global || !locked)
{
if constexpr(is_same<A,bool>::value)
operator =(val == "true");
else if constexpr(is_integral<A>::value)
operator =(stoi(val));
else
operator =(val);
}
}

XmlConfParam &operator=(const A &other)
Expand Down Expand Up @@ -73,12 +81,11 @@ class XmlConf::Private
Private(const string &path = {}, string schema = {});

void init(const string &path, bool global);
unique_ptr<Configuration> read(const string &path);
unique_ptr<Configuration> read(const string &path) const;
template <class A>
void setUserConf(XmlConfParam<A> &param, const A &defined, const A &value);
string tostring(bool val) const { return val ? "true" : "false"; }
string tostring(int val) const { return to_string(val); }
string tostring(const string &val) const { return val; }
static string to_string(bool val) { return val ? "true" : "false"; }
static string to_string(const string &val) { return val; }


XmlConfParam<int> logLevel{"log.level", 3};
Expand Down Expand Up @@ -150,7 +157,7 @@ void XmlConf::Private::init(const string& path, bool global)
for(const Configuration::ParamType &p: conf->param())
{
if(p.name() == logLevel.name)
logLevel.setValue(atoi(string(p).c_str()), p.lock(), global);
logLevel.setValue(p, p.lock(), global);
else if(p.name() == logFile.name)
logFile.setValue(p, p.lock(), global);
else if(p.name() == digestUri.name)
Expand All @@ -160,9 +167,9 @@ void XmlConf::Private::init(const string& path, bool global)
else if(p.name() == PKCS11Driver.name)
PKCS11Driver.setValue(p, p.lock(), global);
else if(p.name() == proxyForceSSL.name)
proxyForceSSL.setValue(p == "true", p.lock(), global);
proxyForceSSL.setValue(p, p.lock(), global);
else if(p.name() == proxyTunnelSSL.name)
proxyTunnelSSL.setValue(p == "true", p.lock(), global);
proxyTunnelSSL.setValue(p, p.lock(), global);
else if(p.name() == proxyHost.name)
proxyHost.setValue(p, p.lock(), global);
else if(p.name() == proxyPort.name)
Expand All @@ -179,17 +186,17 @@ void XmlConf::Private::init(const string& path, bool global)
else if(p.name() == PKCS12Pass.name)
PKCS12Pass.setValue(p, p.lock(), global);
else if(p.name() == PKCS12Disable.name)
PKCS12Disable.setValue(p == "true", p.lock(), global);
PKCS12Disable.setValue(p, p.lock(), global);
else if(p.name() == TSUrl.name)
TSUrl.setValue(p, p.lock(), global);
else if(p.name() == TSLAutoUpdate.name)
TSLAutoUpdate.setValue(p == "true", p.lock(), global);
TSLAutoUpdate.setValue(p, p.lock(), global);
else if(p.name() == TSLCache.name)
TSLCache.setValue(p, p.lock(), global);
else if(p.name() == TSLOnlineDigest.name)
TSLOnlineDigest.setValue(p == "true", p.lock(), global);
TSLOnlineDigest.setValue(p, p.lock(), global);
else if(p.name() == TSLTimeOut.name)
TSLTimeOut.setValue(stoi(p), p.lock(), global);
TSLTimeOut.setValue(p, p.lock(), global);
else if(p.name() == verifyServiceUri.name)
verifyServiceUri.setValue(p, p.lock(), global);
else if(p.name() == "ocsp.tm.profile" && global)
Expand All @@ -216,7 +223,7 @@ void XmlConf::Private::init(const string& path, bool global)
* @param path to parse xml config
* @return returns parsed xml configuration
*/
unique_ptr<Configuration> XmlConf::Private::read(const string &path)
unique_ptr<Configuration> XmlConf::Private::read(const string &path) const
{
try
{
Expand Down Expand Up @@ -277,34 +284,35 @@ void XmlConf::Private::setUserConf(XmlConfParam<A> &param, const A &defined, con
}
}
if(defined != value) //if it's a new parameter
paramSeq.push_back(Param(tostring(value), param.name));
paramSeq.push_back({to_string(value), param.name});
}
catch (const xml_schema::Exception& e)
{
THROW("(in set %s) Failed to parse configuration: %s", param.name.c_str(), e.what());
}

File::createDirectory(File::directory(USER_CONF_LOC));
ofstream ofs(File::encodeName(USER_CONF_LOC).c_str());
ofstream ofs(File::encodeName(USER_CONF_LOC));
if (ofs.fail())
THROW("Failed to open configuration: %s", USER_CONF_LOC.c_str());
NamespaceInfomap map;
map[string()].name = string();
map[string()].schema = SCHEMA_LOC;
map[{}].name = {};
map[{}].schema = SCHEMA_LOC;
configuration(ofs, *conf, map, "UTF-8", Flags::dont_initialize);
}


/**
* @typedef digidoc::XmlConfCurrent
* @see digidoc::XmlConfV5
*/

/**
* @class digidoc::XmlConf
* @brief XML Configuration class
* @deprecated See digidoc::XmlConfV2
* @deprecated Use digidoc::XmlConfV5
* @see digidoc::Conf
*/
/**
* @deprecated See digidoc::XmlConfV2::XmlConfV2
*/
XmlConf::XmlConf(const string &path, const string &schema)
: d(make_unique<XmlConf::Private>(path, schema.empty() ? File::path(xsdPath(), "conf.xsd") : schema))
{}
Expand All @@ -318,12 +326,9 @@ XmlConf* XmlConf::instance() { return dynamic_cast<XmlConf*>(Conf::instance());
/**
* @class digidoc::XmlConfV2
* @brief Version 2 of XML Configuration class
* @deprecated See digidoc::XmlConfV3
* @deprecated Use digidoc::XmlConfV5
* @see digidoc::ConfV2
*/
/**
* @deprecated See digidoc::XmlConfV3::XmlConfV3
*/
XmlConfV2::XmlConfV2(const string &path, const string &schema)
: d(make_unique<XmlConf::Private>(path, schema.empty() ? File::path(xsdPath(), "conf.xsd") : schema))
{}
Expand All @@ -337,12 +342,9 @@ XmlConfV2* XmlConfV2::instance() { return dynamic_cast<XmlConfV2*>(Conf::instanc
/**
* @class digidoc::XmlConfV3
* @brief Version 3 of XML Configuration class
* @deprecated See digidoc::XmlConfV4
* @deprecated Use digidoc::XmlConfV5
* @see digidoc::ConfV3
*/
/**
* @deprecated See digidoc::XmlConfV4::XmlConfV4
*/
XmlConfV3::XmlConfV3(const string &path, const string &schema)
: d(make_unique<XmlConf::Private>(path, schema.empty() ? File::path(xsdPath(), "conf.xsd") : schema))
{}
Expand All @@ -356,6 +358,7 @@ XmlConfV3* XmlConfV3::instance() { return dynamic_cast<XmlConfV3*>(Conf::instanc
/**
* @class digidoc::XmlConfV4
* @brief Version 4 of XML Configuration class
* @deprecated Use digidoc::XmlConfV5
* @see digidoc::ConfV4
*/
/**
Expand Down