Signature.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 #include <system/multicast_delegate.h>
5 #include <system/date_time.h>
6 #include <system/array.h>
7 #include <cstdint>
8 
9 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
10 
11 namespace Aspose
12 {
13 namespace Pdf
14 {
15 namespace Annotations
16 {
17 class WidgetAnnotation;
18 } // namespace Annotations
19 namespace Engine
20 {
21 namespace Data
22 {
23 class IPdfArray;
24 class IPdfDictionary;
25 } // namespace Data
26 namespace IO
27 {
28 namespace ConvertStrategies
29 {
30 class VersionConvertStrategy;
31 } // namespace ConvertStrategies
32 } // namespace IO
33 class IPdfDocument;
34 namespace Security
35 {
36 namespace Impl
37 {
38 namespace Signatures
39 {
40 class FieldLockDictionary;
41 namespace Sanitization
42 {
43 class DigitalSignatureSanitization;
44 } // namespace Sanitization
45 class SignatureReference;
46 } // namespace Signatures
47 } // namespace Impl
48 class ISignature;
49 } // namespace Security
50 } // namespace Engine
51 namespace Facades
52 {
53 class PdfFileSignature;
54 } // namespace Facades
55 namespace Forms
56 {
57 class DocMDPSignature;
58 class ExternalSignature;
59 class PKCS1;
60 class PKCS7;
61 class PKCS7Detached;
62 class SignatureCustomAppearance;
63 class SignatureField;
64 } // namespace Forms
65 class OcspSettings;
66 class TimestampSettings;
67 } // namespace Pdf
68 } // namespace Aspose
69 namespace System
70 {
71 namespace Collections
72 {
73 namespace Generic
74 {
75 template <typename> class IList;
76 } // namespace Generic
77 } // namespace Collections
78 namespace IO
79 {
80 class Stream;
81 } // namespace IO
82 } // namespace System
83 
84 namespace Aspose {
85 
86 namespace Pdf {
87 
88 namespace Forms {
89 
90 using SignHash = System::MulticastDelegate<System::ArrayPtr<uint8_t>(System::ArrayPtr<uint8_t>)>;
91 
97 class ASPOSE_PDF_SHARED_CLASS Signature : public System::Object
98 {
99  typedef Signature ThisType;
100  typedef System::Object BaseType;
101 
102  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
103  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
104 
107  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::VersionConvertStrategy;
114 
115 public:
116 
120  ASPOSE_PDF_SHARED_API System::SharedPtr<SignatureCustomAppearance> get_CustomAppearance() const;
124  ASPOSE_PDF_SHARED_API void set_CustomAppearance(System::SharedPtr<SignatureCustomAppearance> value);
128  ASPOSE_PDF_SHARED_API System::String get_Authority() const;
132  ASPOSE_PDF_SHARED_API void set_Authority(System::String value);
136  ASPOSE_PDF_SHARED_API System::DateTime get_Date() const;
140  ASPOSE_PDF_SHARED_API void set_Date(System::DateTime value);
144  ASPOSE_PDF_SHARED_API System::String get_Location() const;
148  ASPOSE_PDF_SHARED_API void set_Location(System::String value);
152  ASPOSE_PDF_SHARED_API System::String get_Reason() const;
156  ASPOSE_PDF_SHARED_API void set_Reason(System::String value);
161  ASPOSE_PDF_SHARED_API System::String get_ContactInfo() const;
166  ASPOSE_PDF_SHARED_API void set_ContactInfo(System::String value);
171  ASPOSE_PDF_SHARED_API System::ArrayPtr<int32_t> get_ByteRange() const;
175  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::TimestampSettings> get_TimestampSettings() const;
179  ASPOSE_PDF_SHARED_API void set_TimestampSettings(System::SharedPtr<Aspose::Pdf::TimestampSettings> value);
183  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::OcspSettings> get_OcspSettings() const;
187  ASPOSE_PDF_SHARED_API void set_OcspSettings(System::SharedPtr<Aspose::Pdf::OcspSettings> value);
191  ASPOSE_PDF_SHARED_API bool get_UseLtv() const;
195  ASPOSE_PDF_SHARED_API void set_UseLtv(bool value);
199  ASPOSE_PDF_SHARED_API SignHash get_CustomSignHash() const;
203  ASPOSE_PDF_SHARED_API void set_CustomSignHash(SignHash value);
216  ASPOSE_PDF_SHARED_API bool get_ShowProperties() const;
229  ASPOSE_PDF_SHARED_API void set_ShowProperties(bool value);
230 
236  ASPOSE_PDF_SHARED_API bool Verify();
237 
241  ASPOSE_PDF_SHARED_API Signature();
251  ASPOSE_PDF_SHARED_API Signature(System::String pfx, System::String password);
261  ASPOSE_PDF_SHARED_API Signature(System::SharedPtr<System::IO::Stream> pfx, System::String password);
262 
263 protected:
264 
272 
276  System::SharedPtr<System::IO::Stream> get_Image() const;
280  void set_Image(System::SharedPtr<System::IO::Stream> value);
295 
312  void Clear();
313 
331 
332  virtual ASPOSE_PDF_SHARED_API ~Signature();
333 
334 private:
335 
336  System::String _authority;
337  System::DateTime _date;
338  System::String _location;
339  System::String _reason;
340  System::String _contactInfo;
341  bool mustClose;
342  bool _showProperties;
348  System::SharedPtr<SignatureCustomAppearance> _signatureCustomAppearance;
349  SignHash _customSignHash;
351  bool _useLtv;
352 
354 
355  static struct __StaticConstructor__ { __StaticConstructor__(); } s_constructor__;
356 
357 };
358 
359 } // namespace Forms
360 } // namespace Pdf
361 } // namespace Aspose
362 
363 
System::SharedPtr< Aspose::Pdf::Engine::IPdfDocument > _document
Definition: Signature.h:268
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
Represents the class of document MDP (modification detection and prevention) signature type...
Definition: DocMDPSignature.h:33
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:64
Definition: Artifact.h:67
Represents signature object regarding PKCS#1 standard. RSA encryption algorithm and SHA-1 digest meth...
Definition: PKCS1.h:44
Represents signature form field.
Definition: SignatureField.h:83
Represents the PKCS#7 object that conform to the PKCS#7 specification in Internet RFC 2315...
Definition: PKCS7Detached.h:46
System::SharedPtr< System::IO::Stream > _pfx
Definition: Signature.h:265
Represents the ocsp settings using during signing process.
Definition: OcspSettings.h:15
Represents the PKCS#7 object that conform to the PKCS#7 specification in Internet RFC 2315...
Definition: PKCS7.h:45
Class representing widget annotation.
Definition: WidgetAnnotation.h:93
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
System::SharedPtr< System::IO::Stream > _image
Definition: Signature.h:267
Creates a detached PKCS#7Detached signature using a X509Certificate2. It supports usb smartcards...
Definition: ExternalSignature.h:32
System::SharedPtr< Aspose::Pdf::Engine::Security::ISignature > _signature
Definition: Signature.h:269
Definition: AFRelationship.h:4
An abstract class which represents signature object in the pdf document. Signatures are fields with v...
Definition: Signature.h:97
System::String _password
Definition: Signature.h:266
Represents a specific date and time value on the time continuum. This type should be allocated on sta...
Definition: date_time.h:49
ASPOSE_PDF_SHARED_API void Sign(System::SharedPtr< Aspose::Pdf::Forms::Signature > signature, System::SharedPtr< System::IO::Stream > pfx, System::String pass)
Signs the document using this signature field.
virtual ASPOSE_PDF_SHARED_API System::String get_Value()
Gets value of the field.
Represents a class to sign a pdf file with a certificate.
Definition: PdfFileSignature.h:63
System::String _name
Definition: Signature.h:270
Represents the ocsp settings using during signing process.
Definition: TimestampSettings.h:16
System::ArrayPtr< int32_t > _byteRange
Definition: Signature.h:271
void Clear() override
Removes signature object from field.
System::MulticastDelegate< System::ArrayPtr< uint8_t >(System::ArrayPtr< uint8_t >)> SignHash
Definition: Signature.h:90
Interface of indexed container of elements. Objects of this class should only be allocated using Syst...
Definition: Collection.h:42
Whole PDF file will be submitted.