poppler/SignatureHandler.cc | 85 -------------------------------------------- poppler/SignatureHandler.h | 16 -------- 2 files changed, 101 deletions(-)
New commits: commit 6051948976b63ffa02a93afc9aaea18d2733a4f9 Author: Sune Vuorela <[email protected]> Date: Thu Mar 2 14:41:48 2023 +0100 Remove unused static method diff --git a/poppler/SignatureHandler.cc b/poppler/SignatureHandler.cc index 70f02e90..b87afa6b 100644 --- a/poppler/SignatureHandler.cc +++ b/poppler/SignatureHandler.cc @@ -513,21 +513,6 @@ unsigned int SignatureHandler::digestLength(HashAlgorithm digestAlgId) } } -HashAlgorithm SignatureHandler::getHashOidTag(const char *digestName) -{ - HashAlgorithm tag = HashAlgorithm::Unknown; - if (strcmp(digestName, "SHA1") == 0) { - tag = HashAlgorithm::Sha1; - } else if (strcmp(digestName, "SHA256") == 0) { - tag = HashAlgorithm::Sha256; - } else if (strcmp(digestName, "SHA384") == 0) { - tag = HashAlgorithm::Sha384; - } else if (strcmp(digestName, "SHA512") == 0) { - tag = HashAlgorithm::Sha512; - } - return tag; -} - std::string SignatureHandler::getSignerName() { char *commonName; diff --git a/poppler/SignatureHandler.h b/poppler/SignatureHandler.h index 94459ed0..074652b4 100644 --- a/poppler/SignatureHandler.h +++ b/poppler/SignatureHandler.h @@ -61,8 +61,6 @@ public: static std::vector<std::unique_ptr<X509CertificateInfo>> getAvailableSigningCertificates(); std::unique_ptr<GooString> signDetached(const char *password) const; - static HashAlgorithm getHashOidTag(const char *digestName); - // Initializes the NSS dir with the custom given directory // calling it with an empty string means use the default firefox db, /etc/pki/nssdb, ~/.pki/nssdb // If you don't want a custom NSS dir and the default entries are fine for you, not calling this function is fine commit 7af9565c492205cdad27c08478168d9e53349f83 Author: Sune Vuorela <[email protected]> Date: Thu Mar 2 14:17:15 2023 +0100 Remove unused constructor diff --git a/poppler/SignatureHandler.cc b/poppler/SignatureHandler.cc index 2b60b357..70f02e90 100644 --- a/poppler/SignatureHandler.cc +++ b/poppler/SignatureHandler.cc @@ -821,12 +821,6 @@ SignatureHandler::SignatureHandler(const char *certNickname, HashAlgorithm diges hash_context = HASH_Create(HASH_GetHashTypeByOidTag(ConvertHashAlgorithmToNss(digestAlgTag))); } -SignatureHandler::SignatureHandler() : hash_length(), digest_alg_tag(), CMSitem(), hash_context(nullptr), CMSMessage(nullptr), CMSSignedData(nullptr), CMSSignerInfo(nullptr), signing_cert(nullptr), temp_certs(nullptr) -{ - setNSSDir({}); - CMSMessage = NSS_CMSMessage_Create(nullptr); -} - HASHContext *SignatureHandler::initHashContext() { diff --git a/poppler/SignatureHandler.h b/poppler/SignatureHandler.h index 9f283196..94459ed0 100644 --- a/poppler/SignatureHandler.h +++ b/poppler/SignatureHandler.h @@ -45,7 +45,6 @@ class POPPLER_PRIVATE_EXPORT SignatureHandler { public: - explicit SignatureHandler(); SignatureHandler(unsigned char *p7, int p7_length); SignatureHandler(const char *certNickname, HashAlgorithm digestAlgTag); ~SignatureHandler(); commit f688173900f3c29e802a3c140bdaa9d48d6c7118 Author: Sune Vuorela <[email protected]> Date: Thu Mar 2 12:48:19 2023 +0100 Remove unused ASN bits diff --git a/poppler/SignatureHandler.cc b/poppler/SignatureHandler.cc index 7e475224..2b60b357 100644 --- a/poppler/SignatureHandler.cc +++ b/poppler/SignatureHandler.cc @@ -46,70 +46,6 @@ #include <cms.h> #include <cmst.h> -// ASN.1 used in the (much simpler) time stamp request. From RFC3161 -// and other sources. - -/* -AlgorithmIdentifier ::= SEQUENCE { - algorithm OBJECT IDENTIFIER, - parameters ANY DEFINED BY algorithm OPTIONAL } - -- contains a value of the type - -- registered for use with the - -- algorithm object identifier value - -MessageImprint ::= SEQUENCE { - hashAlgorithm AlgorithmIdentifier, - hashedMessage OCTET STRING } -*/ - -struct MessageImprint -{ - SECAlgorithmID hashAlgorithm; - SECItem hashedMessage; -}; - -/* -Extension ::= SEQUENCE { - extnID OBJECT IDENTIFIER, - critical BOOLEAN DEFAULT FALSE, - extnValue OCTET STRING } -*/ - -struct Extension -{ - SECItem const extnID; - SECItem const critical; - SECItem const extnValue; -}; - -/* -Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension -*/ - -/* -TSAPolicyId ::= OBJECT IDENTIFIER - -TimeStampReq ::= SEQUENCE { - version INTEGER { v1(1) }, - messageImprint MessageImprint, - --a hash algorithm OID and the hash value of the data to be - --time-stamped - reqPolicy TSAPolicyId OPTIONAL, - nonce INTEGER OPTIONAL, - certReq BOOLEAN DEFAULT FALSE, - extensions [0] IMPLICIT Extensions OPTIONAL } -*/ - -struct TimeStampReq -{ - SECItem version; - MessageImprint messageImprint; - SECItem reqPolicy; - SECItem nonce; - SECItem certReq; - Extension *extensions; -}; - /** * General name, defined by RFC 3280. */ commit 64c7f8b3b67902274684f6541c0a931001a6fa20 Author: Sune Vuorela <[email protected]> Date: Thu Mar 2 12:23:10 2023 +0100 Remove unused code diff --git a/poppler/SignatureHandler.h b/poppler/SignatureHandler.h index a391b8a6..9f283196 100644 --- a/poppler/SignatureHandler.h +++ b/poppler/SignatureHandler.h @@ -53,7 +53,6 @@ public: std::string getSignerName(); const char *getSignerSubjectDN(); HashAlgorithm getHashAlgorithm(); - void setSignature(unsigned char *, int); void updateHash(unsigned char *data_block, int data_len); void restartHash(); SignatureValidationStatus validateSignature(); @@ -77,18 +76,6 @@ public: static void setNSSPasswordCallback(const std::function<char *(const char *)> &f); private: - typedef struct - { - enum - { - PW_NONE = 0, - PW_FROMFILE = 1, - PW_PLAINTEXT = 2, - PW_EXTERNAL = 3 - } source; - const char *data; - } PWData; - SignatureHandler(const SignatureHandler &); SignatureHandler &operator=(const SignatureHandler &);
