[poppler] 2 commits - poppler/Form.cc poppler/SignatureInfo.cc poppler/SignatureInfo.h qt5/src
Albert Astals Cid
aacid at kemper.freedesktop.org
Thu Aug 9 14:41:02 UTC 2018
poppler/Form.cc | 10 ++++++++++
poppler/SignatureInfo.cc | 29 +++++++++++++++++++++++++++++
poppler/SignatureInfo.h | 7 +++++++
qt5/src/poppler-form.cc | 17 +++++++++++++++++
qt5/src/poppler-form.h | 13 +++++++++++++
5 files changed, 76 insertions(+)
New commits:
commit 90ace43c5bb52854b4fa1fdd224d0273b8fd6ff0
Author: Chinmoy Ranjan Pradhan <chinmoyrp65 at protonmail.com>
Date: Thu Aug 9 16:39:30 2018 +0200
[qt] Add Reason and Location to SignatureInfo
Small tweaks (spacing) by Albert Astals Cid
Bug #107299
diff --git a/qt5/src/poppler-form.cc b/qt5/src/poppler-form.cc
index 9d1b329a..58b2e57e 100644
--- a/qt5/src/poppler-form.cc
+++ b/qt5/src/poppler-form.cc
@@ -7,6 +7,7 @@
* Copyright (C) 2017, Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
* Copyright (C) 2018, Andre Heinecke <aheinecke at intevation.de>
* Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>. Work sponsored by the LiMux project of the city of Munich
+ * Copyright (C) 2018 Chinmoy Ranjan Pradhan <chinmoyrp65 at protonmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -502,6 +503,8 @@ struct SignatureValidationInfoPrivate {
QByteArray signature;
QString signer_name;
QString signer_subject_dn;
+ QString location;
+ QString reason;
int hash_algorithm;
time_t signing_time;
QList<qint64> range_bounds;
@@ -547,6 +550,18 @@ QString SignatureValidationInfo::signerSubjectDN() const
return d->signer_subject_dn;
}
+QString SignatureValidationInfo::location() const
+{
+ Q_D(const SignatureValidationInfo);
+ return d->location;
+}
+
+QString SignatureValidationInfo::reason() const
+{
+ Q_D(const SignatureValidationInfo);
+ return d->reason;
+}
+
SignatureValidationInfo::HashAlgorithm SignatureValidationInfo::hashAlgorithm() const
{
Q_D(const SignatureValidationInfo);
@@ -715,6 +730,8 @@ SignatureValidationInfo FormFieldSignature::validate(int opt, const QDateTime& v
priv->signer_name = si->getSignerName();
priv->signer_subject_dn = si->getSubjectDN();
priv->hash_algorithm = si->getHashAlgorithm();
+ priv->location = si->getLocation();
+ priv->reason = si->getReason();
priv->signing_time = si->getSigningTime();
const std::vector<Goffset> ranges = fws->getSignedRangeBounds();
diff --git a/qt5/src/poppler-form.h b/qt5/src/poppler-form.h
index 2dc3fe71..ac28a4c6 100644
--- a/qt5/src/poppler-form.h
+++ b/qt5/src/poppler-form.h
@@ -6,6 +6,7 @@
* Copyright (C) 2017, Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
* Copyright (C) 2017, Tobias C. Berner <tcberner at freebsd.org>
* Copyright (C) 2018, Andre Heinecke <aheinecke at intevation.de>
+ * Copyright (C) 2018, Chinmoy Ranjan Pradhan <chinmoyrp65 at protonmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -480,6 +481,18 @@ namespace Poppler {
QString signerSubjectDN() const;
/**
+ Get signing location.
+ \since 0.68
+ */
+ QString location() const;
+
+ /**
+ Get signing reason.
+ \since 0.68
+ */
+ QString reason() const;
+
+ /**
The the hash algorithm used for the signature.
\since 0.58
*/
commit c9bf96aa99059ce0216a75ae2868b79d6e21bc3d
Author: Chinmoy Ranjan Pradhan <chinmoyrp65 at protonmail.com>
Date: Thu Aug 9 16:35:14 2018 +0200
Add Reason and Location to SignatureInfo
Small tweaks (const, etc) by Albert Astals Cid
Bug #107299
diff --git a/poppler/Form.cc b/poppler/Form.cc
index 1b2888e9..3f2ab9a1 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -1635,6 +1635,16 @@ void FormFieldSignature::parseInfo()
byte_range = sig_dict.dictLookup("ByteRange");
+ const Object location_obj = sig_dict.dictLookup("Location");
+ if (location_obj.isString()) {
+ signature_info->setLocation(location_obj.getString()->copy()->getCString());
+ }
+
+ const Object reason_obj = sig_dict.dictLookup("Reason");
+ if (reason_obj.isString()) {
+ signature_info->setReason(reason_obj.getString()->copy()->getCString());
+ }
+
// retrieve SigningTime
Object time_of_signing = sig_dict.dictLookup("M");
if (time_of_signing.isString()) {
diff --git a/poppler/SignatureInfo.cc b/poppler/SignatureInfo.cc
index b5314334..25b0552d 100644
--- a/poppler/SignatureInfo.cc
+++ b/poppler/SignatureInfo.cc
@@ -8,6 +8,7 @@
// Copyright 2015 André Esser <bepandre at hotmail.com>
// Copyright 2017 Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
// Copyright 2017, 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65 at protonmail.com>
//
//========================================================================
@@ -32,6 +33,8 @@ SignatureInfo::SignatureInfo()
cert_status = CERTIFICATE_NOT_VERIFIED;
signer_name = nullptr;
subject_dn = nullptr;
+ location = nullptr;
+ reason = nullptr;
hash_type = HASH_AlgNULL;
signing_time = 0;
sig_subfilter_supported = false;
@@ -43,6 +46,8 @@ SignatureInfo::SignatureInfo(SignatureValidationStatus sig_val_status, Certifica
cert_status = cert_val_status;
signer_name = nullptr;
subject_dn = nullptr;
+ location = nullptr;
+ reason = nullptr;
hash_type = HASH_AlgNULL;
signing_time = 0;
sig_subfilter_supported = false;
@@ -50,6 +55,8 @@ SignatureInfo::SignatureInfo(SignatureValidationStatus sig_val_status, Certifica
SignatureInfo::~SignatureInfo()
{
+ free(location);
+ free(reason);
free(signer_name);
free(subject_dn);
}
@@ -76,6 +83,16 @@ const char *SignatureInfo::getSubjectDN()
return subject_dn;
}
+const char *SignatureInfo::getLocation() const
+{
+ return location;
+}
+
+const char *SignatureInfo::getReason() const
+{
+ return reason;
+}
+
int SignatureInfo::getHashAlgorithm()
{
return hash_type;
@@ -110,6 +127,18 @@ void SignatureInfo::setSubjectDN(const char *subjectDN)
subject_dn = strdup(subjectDN);
}
+void SignatureInfo::setLocation(char *loc)
+{
+ free(location);
+ location = loc;
+}
+
+void SignatureInfo::setReason(char *signingReason)
+{
+ free(reason);
+ reason = signingReason;
+}
+
void SignatureInfo::setHashAlgorithm(int type)
{
hash_type = type;
diff --git a/poppler/SignatureInfo.h b/poppler/SignatureInfo.h
index b99e4151..1e9f5f9d 100644
--- a/poppler/SignatureInfo.h
+++ b/poppler/SignatureInfo.h
@@ -8,6 +8,7 @@
// Copyright 2015 André Esser <bepandre at hotmail.com>
// Copyright 2015, 2017, 2018 Albert Astals Cid <aacid at kde.org>
// Copyright 2017 Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
+// Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65 at protonmail.com>
//
//========================================================================
@@ -49,6 +50,8 @@ public:
CertificateValidationStatus getCertificateValStatus();
const char *getSignerName();
const char *getSubjectDN();
+ const char *getLocation() const;
+ const char *getReason() const;
int getHashAlgorithm(); // Returns a NSS3 HASH_HashType or -1 if compiled without NSS3
time_t getSigningTime();
bool isSubfilterSupported() { return sig_subfilter_supported; }
@@ -58,6 +61,8 @@ public:
void setCertificateValStatus(enum CertificateValidationStatus );
void setSignerName(char *);
void setSubjectDN(const char *);
+ void setLocation(char *);
+ void setReason(char *);
void setHashAlgorithm(int);
void setSigningTime(time_t);
void setSubFilterSupport(bool isSupported) { sig_subfilter_supported = isSupported; }
@@ -70,6 +75,8 @@ private:
CertificateValidationStatus cert_status;
char *signer_name;
char *subject_dn;
+ char *location;
+ char *reason;
int hash_type;
time_t signing_time;
bool sig_subfilter_supported;
More information about the poppler
mailing list