Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-07 10:14:53

0001 //========================================================================
0002 //
0003 // SignatureInfo.h
0004 //
0005 // This file is licensed under the GPLv2 or later
0006 //
0007 // Copyright 2015 André Guerreiro <aguerreiro1985@gmail.com>
0008 // Copyright 2015 André Esser <bepandre@hotmail.com>
0009 // Copyright 2015, 2017, 2018, 2020 Albert Astals Cid <aacid@kde.org>
0010 // Copyright 2017 Hans-Ulrich Jüttner <huj@froreich-bioscientia.de>
0011 // Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65@protonmail.com>
0012 // Copyright 2018 Oliver Sander <oliver.sander@tu-dresden.de>
0013 // Copyright 2021 Georgiy Sgibnev <georgiy@sgibnev.com>. Work sponsored by lab50.net.
0014 // Copyright 2021 André Guerreiro <aguerreiro1985@gmail.com>
0015 // Copyright 2021 Marek Kasik <mkasik@redhat.com>
0016 // Copyright 2023, 2024 g10 Code GmbH, Author: Sune Stolborg Vuorela <sune@vuorela.dk>
0017 //
0018 //========================================================================
0019 
0020 #ifndef SIGNATUREINFO_H
0021 #define SIGNATUREINFO_H
0022 
0023 #include <memory>
0024 #include <ctime>
0025 
0026 #include "poppler_private_export.h"
0027 #include "goo/GooString.h"
0028 #include "HashAlgorithm.h"
0029 
0030 enum SignatureValidationStatus
0031 {
0032     SIGNATURE_VALID,
0033     SIGNATURE_INVALID,
0034     SIGNATURE_DIGEST_MISMATCH,
0035     SIGNATURE_DECODING_ERROR,
0036     SIGNATURE_GENERIC_ERROR,
0037     SIGNATURE_NOT_FOUND,
0038     SIGNATURE_NOT_VERIFIED
0039 };
0040 
0041 enum CertificateValidationStatus
0042 {
0043     CERTIFICATE_TRUSTED,
0044     CERTIFICATE_UNTRUSTED_ISSUER,
0045     CERTIFICATE_UNKNOWN_ISSUER,
0046     CERTIFICATE_REVOKED,
0047     CERTIFICATE_EXPIRED,
0048     CERTIFICATE_GENERIC_ERROR,
0049     CERTIFICATE_NOT_VERIFIED
0050 };
0051 
0052 class X509CertificateInfo;
0053 
0054 class POPPLER_PRIVATE_EXPORT SignatureInfo
0055 {
0056 public:
0057     SignatureInfo();
0058     ~SignatureInfo();
0059 
0060     SignatureInfo(const SignatureInfo &) = delete;
0061     SignatureInfo &operator=(const SignatureInfo &) = delete;
0062 
0063     /* GETTERS */
0064     SignatureValidationStatus getSignatureValStatus() const;
0065     std::string getSignerName() const;
0066     std::string getSubjectDN() const;
0067     const GooString &getLocation() const;
0068     const GooString &getReason() const;
0069     HashAlgorithm getHashAlgorithm() const; // Returns the used HashAlgorithm, and unknown if compiled without signature support
0070     time_t getSigningTime() const;
0071     bool isSubfilterSupported() const { return sig_subfilter_supported; }
0072     const X509CertificateInfo *getCertificateInfo() const;
0073 
0074     /* SETTERS */
0075     void setSignatureValStatus(enum SignatureValidationStatus);
0076     void setSignerName(const std::string &);
0077     void setSubjectDN(const std::string &);
0078     void setLocation(const GooString *);
0079     void setReason(const GooString *);
0080     void setHashAlgorithm(HashAlgorithm);
0081     void setSigningTime(time_t);
0082     void setSubFilterSupport(bool isSupported) { sig_subfilter_supported = isSupported; }
0083     void setCertificateInfo(std::unique_ptr<X509CertificateInfo>);
0084 
0085 private:
0086     SignatureValidationStatus sig_status = SIGNATURE_NOT_VERIFIED;
0087     std::unique_ptr<X509CertificateInfo> cert_info;
0088     std::string signer_name;
0089     std::string subject_dn;
0090     GooString location;
0091     GooString reason;
0092     HashAlgorithm hash_type = HashAlgorithm::Unknown;
0093     time_t signing_time = 0;
0094     bool sig_subfilter_supported = false;
0095 };
0096 
0097 #endif