AusweisApp2/src/core/CertificateChecker.h

53 lines
1.2 KiB
C
Raw Normal View History

2017-07-03 09:30:10 +02:00
/*!
* \brief Contains the definition of the CertificateChecker class.
*
2018-03-28 15:10:51 +02:00
* \copyright Copyright (c) 2014-2018 Governikus GmbH & Co. KG, Germany
2017-07-03 09:30:10 +02:00
*/
#pragma once
2017-12-20 14:54:05 +01:00
#include "asn1/CVCertificate.h"
2017-07-03 09:30:10 +02:00
#include <QSet>
#include <QSslCertificate>
#include <QString>
2017-12-20 14:54:05 +01:00
#include <functional>
2017-07-03 09:30:10 +02:00
namespace governikus
{
2017-12-20 14:54:05 +01:00
class DIDAuthenticateEAC1;
2017-07-03 09:30:10 +02:00
/*!
* \brief Utility class for checking various constraints on certificates
*
* \copyright Copyright (c) 2015 Governikus GmbH & Co. KG
*/
class CertificateChecker
{
2017-07-03 09:33:28 +02:00
Q_GADGET
2017-07-03 09:30:10 +02:00
public:
2017-07-03 09:33:28 +02:00
enum class CertificateStatus
{
Good,
Unsupported_Algorithm_Or_Length,
Hash_Not_In_Description
};
Q_ENUM(CertificateStatus)
2017-07-03 09:30:10 +02:00
/*!
2017-12-20 14:54:05 +01:00
* Checks certificate and, if OK, save it using a callback function.
*
2017-07-03 09:30:10 +02:00
* \return Returns a translated error string if an error happened, otherwise QString()
*/
2017-12-20 14:54:05 +01:00
static CertificateStatus checkAndSaveCertificate(const QSslCertificate& pCertificate,
const QUrl& pUrl,
const QSharedPointer<DIDAuthenticateEAC1>& pEAC1,
const QSharedPointer<const CVCertificate>& pDvCvc,
const std::function<void(const QUrl&, const QSslCertificate&)>& pSaveCertificateFunc);
2017-07-03 09:30:10 +02:00
};
} // namespace governikus