An abstract class which represents signature object in the pdf document. Signatures are fields with values of signature objects, the last contain data which is used to verify the document validity. More...

#include "Signature.h"

Inherits System::Object.

Inherited by Aspose::Pdf::Forms::ExternalSignature, Aspose::Pdf::Forms::PKCS1, Aspose::Pdf::Forms::PKCS7, and Aspose::Pdf::Forms::PKCS7Detached.

Public Member Functions

ASPOSE_PDF_SHARED_API System::SharedPtr< SignatureCustomAppearanceget_CustomAppearance () const
 Gets/sets the custom appearance. More...
 
ASPOSE_PDF_SHARED_API void set_CustomAppearance (System::SharedPtr< SignatureCustomAppearance > value)
 Gets/sets the custom appearance. More...
 
ASPOSE_PDF_SHARED_API System::String get_Authority () const
 The name of the person or authority signing the document. More...
 
ASPOSE_PDF_SHARED_API void set_Authority (System::String value)
 The name of the person or authority signing the document. More...
 
ASPOSE_PDF_SHARED_API System::DateTime get_Date () const
 The time of signing. More...
 
ASPOSE_PDF_SHARED_API void set_Date (System::DateTime value)
 The time of signing. More...
 
ASPOSE_PDF_SHARED_API System::String get_Location () const
 The CPU host name or physical location of the signing. More...
 
ASPOSE_PDF_SHARED_API void set_Location (System::String value)
 The CPU host name or physical location of the signing. More...
 
ASPOSE_PDF_SHARED_API System::String get_Reason () const
 The reason for the signing, such as (I agree…). More...
 
ASPOSE_PDF_SHARED_API void set_Reason (System::String value)
 The reason for the signing, such as (I agree…). More...
 
ASPOSE_PDF_SHARED_API System::String get_ContactInfo () const
 Information provided by the signer to enable a recipient to contact the signer to verify the signature, e.g. a phone number. More...
 
ASPOSE_PDF_SHARED_API void set_ContactInfo (System::String value)
 Information provided by the signer to enable a recipient to contact the signer to verify the signature, e.g. a phone number. More...
 
ASPOSE_PDF_SHARED_API System::ArrayPtr< int32_t > get_ByteRange () const
 An array of pairs of integers (starting byte offset, length in bytes) that shall describe the exact byte range for the digest calculation. More...
 
ASPOSE_PDF_SHARED_API System::SharedPtr< Aspose::Pdf::TimestampSettingsget_TimestampSettings () const
 Gets/sets timestamp settings. More...
 
ASPOSE_PDF_SHARED_API void set_TimestampSettings (System::SharedPtr< Aspose::Pdf::TimestampSettings > value)
 Gets/sets timestamp settings. More...
 
ASPOSE_PDF_SHARED_API System::SharedPtr< Aspose::Pdf::OcspSettingsget_OcspSettings () const
 Gets/sets ocsp settings. More...
 
ASPOSE_PDF_SHARED_API void set_OcspSettings (System::SharedPtr< Aspose::Pdf::OcspSettings > value)
 Gets/sets ocsp settings. More...
 
ASPOSE_PDF_SHARED_API bool get_UseLtv () const
 Gets/sets ltv validation flag. More...
 
ASPOSE_PDF_SHARED_API void set_UseLtv (bool value)
 Gets/sets ltv validation flag. More...
 
ASPOSE_PDF_SHARED_API SignHash get_CustomSignHash () const
 The delegate for custom sign the document hash (Beta). More...
 
ASPOSE_PDF_SHARED_API void set_CustomSignHash (SignHash value)
 The delegate for custom sign the document hash (Beta). More...
 
ASPOSE_PDF_SHARED_API bool get_ShowProperties () const
 Force to show/hide signature properties.

In case ShowProperties is true signature field has predefined format of appearance (strings to represent):

Digitally signed by {certificate subject} Date: {signature.Date} Reason: {signature.Reason}

Location: {signature.Location}

where {X} is placeholder for X value. Also signature can have image, in this case listed strings are placed over image. ShowProperties is true by default. More...
 
ASPOSE_PDF_SHARED_API void set_ShowProperties (bool value)
 Force to show/hide signature properties.

In case ShowProperties is true signature field has predefined format of appearance (strings to represent):

Digitally signed by {certificate subject} Date: {signature.Date} Reason: {signature.Reason}

Location: {signature.Location}

where {X} is placeholder for X value. Also signature can have image, in this case listed strings are placed over image. ShowProperties is true by default. More...
 
ASPOSE_PDF_SHARED_API bool Verify ()
 Verify the document regarding this signature and return true if document is valid or otherwise false. More...
 
ASPOSE_PDF_SHARED_API Signature ()
 Inititalizes new instance of the Signature class. More...
 
ASPOSE_PDF_SHARED_API Signature (System::String pfx, System::String password)
 Inititalizes new instance of the Signature class. More...
 
ASPOSE_PDF_SHARED_API Signature (System::SharedPtr< System::IO::Stream > pfx, System::String password)
 Inititalizes new instance of the Signature class. More...
 
- Public Member Functions inherited from System::Object
ASPOSECPP_SHARED_API Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ASPOSECPP_SHARED_API ~Object ()
 Destroys object. Frees all internal data structures. More...
 
ASPOSECPP_SHARED_API Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared reference counter. More...
 
ASPOSECPP_SHARED_API void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
ASPOSECPP_SHARED_API void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual ASPOSECPP_SHARED_API int32_t GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual ASPOSECPP_SHARED_API String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual ASPOSECPP_SHARED_API const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual ASPOSECPP_SHARED_API bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (uint32_t argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
virtual ASPOSECPP_SHARED_API bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 For internal purposes only. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool Equals (double const &objA, double const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 Specialization of Object::ReferenceEquals for case of string and nullptr. More...
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 Specialization of Object::ReferenceEquals for case of strings. More...
 

Protected Member Functions

System::SharedPtr< System::IO::Streamget_Image () const
 Gets image stream. More...
 
void set_Image (System::SharedPtr< System::IO::Stream > value)
 Gets image stream. More...
 
System::SharedPtr< System::IO::Streamget_Pfx () const
 Gets the pfx container value. More...
 
System::SharedPtr< Aspose::Pdf::Engine::Security::ISignature > get_Value () const
 Gets the signature value. More...
 
System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfArray > get_Reference () const
 
void set_Reference (System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfArray > value)
 
System::SharedPtr< System::Collections::Generic::IList< System::SharedPtr< Aspose::Pdf::Engine::Security::Impl::Signatures::SignatureReference > > > get_SignatureReferences () const
 
void set_SignatureReferences (System::SharedPtr< System::Collections::Generic::IList< System::SharedPtr< Aspose::Pdf::Engine::Security::Impl::Signatures::SignatureReference >>> value)
 
System::SharedPtr< Aspose::Pdf::Engine::Security::Impl::Signatures::FieldLockDictionary > get_FieldsLock () const
 
void set_FieldsLock (System::SharedPtr< Aspose::Pdf::Engine::Security::Impl::Signatures::FieldLockDictionary > value)
 
void Sign (System::String sigName, System::SharedPtr< System::IO::Stream > pfx, System::String pass)
 Sign the document using data in this sugnature object. More...
 
void Clear ()
 Removes signature value, but keeps the field from document. More...
 
 Signature (System::SharedPtr< System::IO::Stream > image)
 Initializes signature object with image. More...
 
 Signature (System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDictionary > signature, System::SharedPtr< Aspose::Pdf::Engine::IPdfDocument > document)
 Initialize signature object from signature dictionary. Then this object will be used for verifying the document. More...
 
virtual ASPOSE_PDF_SHARED_API ~Signature ()
 

Protected Attributes

System::SharedPtr< System::IO::Stream_pfx
 
System::String _password
 
System::SharedPtr< System::IO::Stream_image
 
System::SharedPtr< Aspose::Pdf::Engine::IPdfDocument > _document
 
System::SharedPtr< Aspose::Pdf::Engine::Security::ISignature > _signature
 
System::String _name
 
System::ArrayPtr< int32_t > _byteRange
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Implements C# typeof(System.Object) construct. More...
 

Detailed Description

An abstract class which represents signature object in the pdf document. Signatures are fields with values of signature objects, the last contain data which is used to verify the document validity.

Constructor & Destructor Documentation

◆ Signature() [1/5]

ASPOSE_PDF_SHARED_API Aspose::Pdf::Forms::Signature::Signature ( )

Inititalizes new instance of the Signature class.

◆ Signature() [2/5]

ASPOSE_PDF_SHARED_API Aspose::Pdf::Forms::Signature::Signature ( System::String  pfx,
System::String  password 
)

Inititalizes new instance of the Signature class.

Parameters
pfxPfx file which contains certificate for signing.
passwordPassword to get access to the private key in the certificate.

◆ Signature() [3/5]

ASPOSE_PDF_SHARED_API Aspose::Pdf::Forms::Signature::Signature ( System::SharedPtr< System::IO::Stream pfx,
System::String  password 
)

Inititalizes new instance of the Signature class.

Parameters
pfxStream with certificate data organized as pfx.
passwordPassword to get access to the private key in the certificate.

◆ Signature() [4/5]

Aspose::Pdf::Forms::Signature::Signature ( System::SharedPtr< System::IO::Stream image)
protected

Initializes signature object with image.

Parameters
imageImage data.

◆ Signature() [5/5]

Aspose::Pdf::Forms::Signature::Signature ( System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfDictionary >  signature,
System::SharedPtr< Aspose::Pdf::Engine::IPdfDocument >  document 
)
protected

Initialize signature object from signature dictionary. Then this object will be used for verifying the document.

Parameters
signatureSignature dictionary.
documentThe document, it is used then to get file data in order to verify signature.

◆ ~Signature()

virtual ASPOSE_PDF_SHARED_API Aspose::Pdf::Forms::Signature::~Signature ( )
protectedvirtual

Member Function Documentation

◆ Clear()

void Aspose::Pdf::Forms::Signature::Clear ( )
protected

Removes signature value, but keeps the field from document.

◆ get_Authority()

ASPOSE_PDF_SHARED_API System::String Aspose::Pdf::Forms::Signature::get_Authority ( ) const

The name of the person or authority signing the document.

◆ get_ByteRange()

ASPOSE_PDF_SHARED_API System::ArrayPtr<int32_t> Aspose::Pdf::Forms::Signature::get_ByteRange ( ) const

An array of pairs of integers (starting byte offset, length in bytes) that shall describe the exact byte range for the digest calculation.

◆ get_ContactInfo()

ASPOSE_PDF_SHARED_API System::String Aspose::Pdf::Forms::Signature::get_ContactInfo ( ) const

Information provided by the signer to enable a recipient to contact the signer to verify the signature, e.g. a phone number.

◆ get_CustomAppearance()

ASPOSE_PDF_SHARED_API System::SharedPtr<SignatureCustomAppearance> Aspose::Pdf::Forms::Signature::get_CustomAppearance ( ) const

Gets/sets the custom appearance.

◆ get_CustomSignHash()

ASPOSE_PDF_SHARED_API SignHash Aspose::Pdf::Forms::Signature::get_CustomSignHash ( ) const

The delegate for custom sign the document hash (Beta).

◆ get_Date()

ASPOSE_PDF_SHARED_API System::DateTime Aspose::Pdf::Forms::Signature::get_Date ( ) const

The time of signing.

◆ get_FieldsLock()

System::SharedPtr<Aspose::Pdf::Engine::Security::Impl::Signatures::FieldLockDictionary> Aspose::Pdf::Forms::Signature::get_FieldsLock ( ) const
protected

◆ get_Image()

System::SharedPtr<System::IO::Stream> Aspose::Pdf::Forms::Signature::get_Image ( ) const
protected

Gets image stream.

◆ get_Location()

ASPOSE_PDF_SHARED_API System::String Aspose::Pdf::Forms::Signature::get_Location ( ) const

The CPU host name or physical location of the signing.

◆ get_OcspSettings()

ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::OcspSettings> Aspose::Pdf::Forms::Signature::get_OcspSettings ( ) const

Gets/sets ocsp settings.

◆ get_Pfx()

System::SharedPtr<System::IO::Stream> Aspose::Pdf::Forms::Signature::get_Pfx ( ) const
protected

Gets the pfx container value.

◆ get_Reason()

ASPOSE_PDF_SHARED_API System::String Aspose::Pdf::Forms::Signature::get_Reason ( ) const

The reason for the signing, such as (I agree…).

◆ get_Reference()

System::SharedPtr<Aspose::Pdf::Engine::Data::IPdfArray> Aspose::Pdf::Forms::Signature::get_Reference ( ) const
protected

◆ get_ShowProperties()

ASPOSE_PDF_SHARED_API bool Aspose::Pdf::Forms::Signature::get_ShowProperties ( ) const

Force to show/hide signature properties.

In case ShowProperties is true signature field has predefined format of appearance (strings to represent):

Digitally signed by {certificate subject} Date: {signature.Date} Reason: {signature.Reason}

Location: {signature.Location}

where {X} is placeholder for X value. Also signature can have image, in this case listed strings are placed over image. ShowProperties is true by default.

◆ get_SignatureReferences()

System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<Aspose::Pdf::Engine::Security::Impl::Signatures::SignatureReference> > > Aspose::Pdf::Forms::Signature::get_SignatureReferences ( ) const
protected

◆ get_TimestampSettings()

ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::TimestampSettings> Aspose::Pdf::Forms::Signature::get_TimestampSettings ( ) const

Gets/sets timestamp settings.

◆ get_UseLtv()

ASPOSE_PDF_SHARED_API bool Aspose::Pdf::Forms::Signature::get_UseLtv ( ) const

Gets/sets ltv validation flag.

◆ get_Value()

System::SharedPtr<Aspose::Pdf::Engine::Security::ISignature> Aspose::Pdf::Forms::Signature::get_Value ( ) const
protected

Gets the signature value.

◆ set_Authority()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_Authority ( System::String  value)

The name of the person or authority signing the document.

◆ set_ContactInfo()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_ContactInfo ( System::String  value)

Information provided by the signer to enable a recipient to contact the signer to verify the signature, e.g. a phone number.

◆ set_CustomAppearance()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_CustomAppearance ( System::SharedPtr< SignatureCustomAppearance value)

Gets/sets the custom appearance.

◆ set_CustomSignHash()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_CustomSignHash ( SignHash  value)

The delegate for custom sign the document hash (Beta).

◆ set_Date()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_Date ( System::DateTime  value)

The time of signing.

◆ set_FieldsLock()

void Aspose::Pdf::Forms::Signature::set_FieldsLock ( System::SharedPtr< Aspose::Pdf::Engine::Security::Impl::Signatures::FieldLockDictionary >  value)
protected

◆ set_Image()

void Aspose::Pdf::Forms::Signature::set_Image ( System::SharedPtr< System::IO::Stream value)
protected

Gets image stream.

◆ set_Location()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_Location ( System::String  value)

The CPU host name or physical location of the signing.

◆ set_OcspSettings()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_OcspSettings ( System::SharedPtr< Aspose::Pdf::OcspSettings value)

Gets/sets ocsp settings.

◆ set_Reason()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_Reason ( System::String  value)

The reason for the signing, such as (I agree…).

◆ set_Reference()

void Aspose::Pdf::Forms::Signature::set_Reference ( System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfArray >  value)
protected

◆ set_ShowProperties()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_ShowProperties ( bool  value)

Force to show/hide signature properties.

In case ShowProperties is true signature field has predefined format of appearance (strings to represent):

Digitally signed by {certificate subject} Date: {signature.Date} Reason: {signature.Reason}

Location: {signature.Location}

where {X} is placeholder for X value. Also signature can have image, in this case listed strings are placed over image. ShowProperties is true by default.

◆ set_SignatureReferences()

void Aspose::Pdf::Forms::Signature::set_SignatureReferences ( System::SharedPtr< System::Collections::Generic::IList< System::SharedPtr< Aspose::Pdf::Engine::Security::Impl::Signatures::SignatureReference >>>  value)
protected

◆ set_TimestampSettings()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_TimestampSettings ( System::SharedPtr< Aspose::Pdf::TimestampSettings value)

Gets/sets timestamp settings.

◆ set_UseLtv()

ASPOSE_PDF_SHARED_API void Aspose::Pdf::Forms::Signature::set_UseLtv ( bool  value)

Gets/sets ltv validation flag.

◆ Sign()

void Aspose::Pdf::Forms::Signature::Sign ( System::String  sigName,
System::SharedPtr< System::IO::Stream pfx,
System::String  pass 
)
protected

Sign the document using data in this sugnature object.

Parameters
sigNameRepresents the name of the signature field which will contain this signature object.
pfxStream with certificate data organized as pfx.
passPassword to get access to the private key in the certificate.

◆ Verify()

ASPOSE_PDF_SHARED_API bool Aspose::Pdf::Forms::Signature::Verify ( )

Verify the document regarding this signature and return true if document is valid or otherwise false.

Returns
true if document is valid.

Member Data Documentation

◆ _byteRange

System::ArrayPtr<int32_t> Aspose::Pdf::Forms::Signature::_byteRange
protected

◆ _document

System::SharedPtr<Aspose::Pdf::Engine::IPdfDocument> Aspose::Pdf::Forms::Signature::_document
protected

◆ _image

System::SharedPtr<System::IO::Stream> Aspose::Pdf::Forms::Signature::_image
protected

◆ _name

System::String Aspose::Pdf::Forms::Signature::_name
protected

◆ _password

System::String Aspose::Pdf::Forms::Signature::_password
protected

◆ _pfx

System::SharedPtr<System::IO::Stream> Aspose::Pdf::Forms::Signature::_pfx
protected

◆ _signature

System::SharedPtr<Aspose::Pdf::Engine::Security::ISignature> Aspose::Pdf::Forms::Signature::_signature
protected