7 #ifndef PDF_SIGNER_CMS_H
8 #define PDF_SIGNER_CMS_H
11 #include "PdfSigner.h"
23 using PdfSigningService = std::function<void(
bufferview hashToSign,
bool dryrun, charbuff& signedHash)>;
24 using PdfSignedHashHandler = std::function<void(
bufferview signedhHash,
bool dryrun)>;
40 struct PODOFO_API PdfSignerCmsParams final
42 PdfSignatureType SignatureType = PdfSignatureType::PAdES_B;
43 PdfSignatureEncryption Encryption = PdfSignatureEncryption::RSA;
44 PdfHashingAlgorithm Hashing = PdfHashingAlgorithm::SHA256;
45 PdfSigningService SigningService;
46 nullable<std::chrono::seconds> SigningTimeUTC;
47 PdfSignedHashHandler SignedHashHandler;
72 const PdfSignerCmsParams& parameters = { });
83 void AppendData(
const bufferview& data)
override;
84 void ComputeSignature(
charbuff& buffer,
bool dryrun)
override;
85 void FetchIntermediateResult(
charbuff& result)
override;
86 void ComputeSignatureDeferred(
const bufferview& processedResult,
charbuff& contents,
bool dryrun)
override;
87 void Reset()
override;
88 std::string GetSignatureFilter()
const override;
89 std::string GetSignatureSubFilter()
const override;
90 std::string GetSignatureType()
const override;
91 bool SkipBufferClear()
const override;
103 void ReserveAttributeSize(
unsigned attrSize);
106 const PdfSignerCmsParams& GetParameters()
const {
return m_parameters; }
109 void ensureEventBasedSigning();
110 void ensureDeferredSigning();
111 void checkContextInitialized();
112 void ensureContextInitialized();
118 std::unique_ptr<CmsContext> m_cmsContext;
119 struct evp_pkey_st* m_privKey;
120 PdfSignerCmsParams m_parameters;
121 unsigned m_reservedSize;
This class computes a CMS signature according to RFC 5652.
Definition: PdfSignerCms.h:63
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition: basetypes.h:38
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition: basetypes.h:16
PdfSignatureAttributeFlags
Definition: PdfSignerCms.h:52
@ SignedAttribute
The input is interpreted as a raw octet string.
@ None
The attribute is a signed attribute. By default, it is unsigned.
cspan< char > bufferview
Convenient read-only char buffer span.
Definition: basetypes.h:19
PdfSignerCmsFlags
Definition: PdfSignerCms.h:27
@ None
When supplying a PdfSigningService, specify if the service expects a bare digest (the default),...
@ ServiceDoWrapDigest
When supplying an external PdfSigningService, specify if the service should be called for a dry run.