2021-05-24 07:25:56 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2018 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2019-01-05 22:30:25 +00:00
|
|
|
|
2019-07-14 07:12:06 +00:00
|
|
|
#ifndef _OKULAR_GENERATOR_PDF_SIGNATUREUTILS_H_
|
|
|
|
#define _OKULAR_GENERATOR_PDF_SIGNATUREUTILS_H_
|
2019-01-05 22:30:25 +00:00
|
|
|
|
|
|
|
#include <poppler-form.h>
|
2022-04-29 21:57:01 +00:00
|
|
|
#include <poppler-version.h>
|
|
|
|
#define POPPLER_VERSION_MACRO ((POPPLER_VERSION_MAJOR << 16) | (POPPLER_VERSION_MINOR << 8) | (POPPLER_VERSION_MICRO))
|
2019-01-05 22:30:25 +00:00
|
|
|
|
|
|
|
#include "core/signatureutils.h"
|
|
|
|
|
|
|
|
class PopplerCertificateInfo : public Okular::CertificateInfo
|
|
|
|
{
|
|
|
|
public:
|
2021-08-21 23:14:34 +00:00
|
|
|
explicit PopplerCertificateInfo(const Poppler::CertificateInfo &info);
|
2019-12-18 11:51:13 +00:00
|
|
|
~PopplerCertificateInfo() override;
|
2019-01-05 22:30:25 +00:00
|
|
|
|
|
|
|
bool isNull() const override;
|
|
|
|
int version() const override;
|
|
|
|
QByteArray serialNumber() const override;
|
|
|
|
QString issuerInfo(EntityInfoKey) const override;
|
|
|
|
QString subjectInfo(EntityInfoKey) const override;
|
2020-01-18 14:54:47 +00:00
|
|
|
QString nickName() const override;
|
2019-01-05 22:30:25 +00:00
|
|
|
QDateTime validityStart() const override;
|
|
|
|
QDateTime validityEnd() const override;
|
|
|
|
KeyUsageExtensions keyUsageExtensions() const override;
|
|
|
|
QByteArray publicKey() const override;
|
|
|
|
PublicKeyType publicKeyType() const override;
|
|
|
|
int publicKeyStrength() const override;
|
|
|
|
bool isSelfSigned() const override;
|
|
|
|
QByteArray certificateData() const override;
|
2020-11-26 16:45:59 +00:00
|
|
|
bool checkPassword(const QString &password) const override;
|
2019-01-05 22:30:25 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Poppler::CertificateInfo m_info;
|
|
|
|
};
|
|
|
|
|
|
|
|
class PopplerSignatureInfo : public Okular::SignatureInfo
|
|
|
|
{
|
|
|
|
public:
|
2021-08-21 23:14:34 +00:00
|
|
|
explicit PopplerSignatureInfo(const Poppler::SignatureValidationInfo &info);
|
2019-12-18 11:51:13 +00:00
|
|
|
~PopplerSignatureInfo() override;
|
2019-01-05 22:30:25 +00:00
|
|
|
|
|
|
|
SignatureStatus signatureStatus() const override;
|
|
|
|
CertificateStatus certificateStatus() const override;
|
|
|
|
QString signerName() const override;
|
|
|
|
QString signerSubjectDN() const override;
|
|
|
|
QString location() const override;
|
|
|
|
QString reason() const override;
|
|
|
|
HashAlgorithm hashAlgorithm() const override;
|
|
|
|
QDateTime signingTime() const override;
|
|
|
|
QByteArray signature() const override;
|
|
|
|
QList<qint64> signedRangeBounds() const override;
|
|
|
|
bool signsTotalDocument() const override;
|
|
|
|
const Okular::CertificateInfo &certificateInfo() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Poppler::SignatureValidationInfo m_info;
|
|
|
|
Okular::CertificateInfo *m_certfiticateInfo;
|
|
|
|
};
|
|
|
|
|
2022-04-29 21:57:01 +00:00
|
|
|
#if POPPLER_VERSION_MACRO >= QT_VERSION_CHECK(21, 1, 0)
|
2019-12-11 09:44:55 +00:00
|
|
|
|
|
|
|
class PopplerCertificateStore : public Okular::CertificateStore
|
|
|
|
{
|
|
|
|
public:
|
2022-04-29 21:57:01 +00:00
|
|
|
~PopplerCertificateStore() override;
|
2019-12-11 09:44:55 +00:00
|
|
|
|
2020-11-26 20:51:46 +00:00
|
|
|
QList<Okular::CertificateInfo *> signingCertificates(bool *userCancelled) const override;
|
2019-12-11 09:44:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2019-01-05 22:30:25 +00:00
|
|
|
#endif
|