11#include "PdfAnnotation.h"
15#include <podofo/auxiliary/InputDevice.h>
16#include <podofo/auxiliary/OutputDevice.h>
22enum class PdfCertPermission : uint8_t
29struct PdfSignatureBeacons final
31 PdfSignatureBeacons();
32 charbuff ContentsBeacon;
33 charbuff ByteRangeBeacon;
34 std::shared_ptr<size_t> ContentsOffset;
35 std::shared_ptr<size_t> ByteRangeOffset;
58class PODOFO_API PdfSignature final :
public PdfField
60 friend class PdfField;
61 friend class PdfSigningContext;
62 friend class PdfDocument;
65 PdfSignature(PdfAcroForm& acroform, std::shared_ptr<PdfField>&& parent);
67 PdfSignature(PdfAnnotationWidget& widget, std::shared_ptr<PdfField>&& parent);
69 PdfSignature(PdfObject& obj, PdfAcroForm* acroform);
80 bool TryVerifySignature(InputStreamDevice& input, PdfSignatureVerifyStatus& status)
const;
85 void SetSignerName(nullable<const PdfString&> text);
90 void SetSignatureReason(nullable<const PdfString&> text);
95 void SetSignatureLocation(nullable<const PdfString&> text);
97 [[deprecated(
"Use the SetCreatingApplication method instead")]]
98 void SetSignatureCreator(nullable<const PdfString&> creator);
103 void SetCreatingApplication(nullable<const PdfName&> application);
106 void SetSignatureDate(nullable<const PdfDate&> sigDate);
111 void AddCertificationReference(PdfCertPermission perm = PdfCertPermission::NoPerms);
116 nullable<const PdfString&> GetSignerName()
const;
121 nullable<const PdfString&> GetSignatureReason()
const;
126 nullable<const PdfString&> GetSignatureLocation()
const;
131 nullable<PdfDate> GetSignatureDate()
const;
137 void EnsureValueObject();
139 PdfSignature* GetParent();
140 const PdfSignature* GetParent()
const;
145 bool TryGetPreviousRevision(InputStreamDevice& input, OutputStreamDevice& output)
const;
148 PdfObject* getValueObject()
const override;
163 void PrepareForSigning(
const std::string_view& filter,
164 const std::string_view& subFilter,
165 const std::string_view& type,
166 const PdfSignatureBeacons& beacons);
169 void SetContentsByteRangeNoDirtySet(
const bufferview& contents, PdfArray&& byteRange);
176 nullable<std::array<size_t, 4>> GetByteRangeBounds()
const;
178 void ensureValueObject();
180 void init(PdfAcroForm& acroForm);
183 PdfObject* m_ValueObj;
This file should be included as the FIRST file in every header of PoDoFo lib.
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
@ Indeterminate
Indeterminate map type, such as non standard identity encodings.
PdfSignatureVerifyStatus
Definition PdfSignature.h:39
@ Invalid
The CMS signature is cryptographically valid over the signed bytes, but the /ByteRange doesn't reach ...
@ CryptoVerifiedPartialCoverage
The CMS signature is cryptographically valid and the /ByteRange covers the whole input.