4#ifndef PDF_SIGNER_CMS_H
5#define PDF_SIGNER_CMS_H
15 typedef struct _xmlNode xmlNode;
16 typedef xmlNode* xmlNodePtr;
23 using PdfSigningService = std::function<void(
bufferview hashToSign,
bool dryrun, charbuff& signedHash)>;
24 using PdfSignedHashHandler = std::function<void(
bufferview signedhHash,
bool dryrun)>;
49 SkipDateValidation = 16,
55 PODOFO_SUPPRESS_DEPRECATED_PUSH
56 struct PODOFO_API PdfSignerCmsParams final
58 PdfSignatureType SignatureType = PdfSignatureType::PAdES_B;
59 [[deprecated(
"Unused: the signing algorithm is automatically detected from the public key in the certificate")]]
60 PdfSignatureEncryption Encryption = PdfSignatureEncryption::RSA;
61 PdfHashingAlgorithm Hashing = PdfHashingAlgorithm::SHA256;
62 PdfSigningService SigningService;
63 nullable<std::chrono::seconds> SigningTimeUTC;
64 PdfSignedHashHandler SignedHashHandler;
65 PdfSignerCmsFlags Flags = PdfSignerCmsFlags::None;
67 PODOFO_SUPPRESS_DEPRECATED_POP
107 void AppendData(
const bufferview& data)
override;
111 void Reset()
override;
112 std::string GetSignatureFilter()
const override;
113 std::string GetSignatureSubFilter()
const override;
114 std::string GetSignatureType()
const override;
115 bool SkipBufferClear()
const override;
124 void ReserveAttributeSize(
unsigned attrSize);
127 unsigned GetSignedHashSize()
const;
129 const PdfSignerCmsParams& GetParameters()
const {
return m_parameters; }
136 void ensureEventBasedSigning();
137 void ensureDeferredSigning();
138 void checkContextInitialized();
139 void ensureContextInitialized();
141 bool shouldVerify()
const;
147 std::unique_ptr<CmsContext> m_cmsContext;
149 PdfSignerCmsParams m_parameters;
150 unsigned m_reservedSize;
This class computes a CMS signature according to RFC 5652.
Definition PdfSignerCms.h:80
A context that can be used to customize the signing process.
Definition PdfSigningContext.h:64
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:30
All classes, functions, types and enums of PoDoFo are members of these namespace.
Definition basetypes.h:13
PdfSignatureAttributeFlags
Definition PdfSignerCms.h:70
@ SignedAttribute
The input is interpreted as a raw octet string.
@ None
Do not add a default appearance.
cspan< char > bufferview
Convenient read-only char buffer span.
Definition basetypes.h:15
PdfSignerCmsFlags
Definition PdfSignerCms.h:27
@ ServiceDoDryRun
For signing algorithms that have a random component, make it deterministic Applies to ECDSA,...
@ ServiceDoWrapDigest
When supplying an external PdfSigningService, specify if the service should be called for a dry run.
@ Deterministic
Skip the inline verification of the signed hash supplied by an external signing service or by a defer...
@ SkipVerification
Skip the validation of the signature date against the validity period of the supplied certificate.