Foxit::PDF::Signature Class Reference

Class to represent PDF signature. More...

Public Member Functions

Boolean Verify (Pause^ pause)
 Verify a signature. More...
 
Boolean Sign (Stream^ savefileStream, Pause^ pause)
 Sign a signature. More...
 
void ClearData ()
 Clear signature data and appearance. More...
 
Boolean IsSigned ()
 Check whether current signature is signed or not. More...
 
SigState GetState ()
 Get current state after current signature is verified by Foxit PDF SDK. More...
 
Boolean ResetAppearanceStream ()
 Reset the appearance stream if current signature is still unsigned. More...
 
Int32 GetPageIndex ()
 Get the index of a PDF page which contains current signature. More...
 
String^ GetPreferredFilter ()
 Get the filter name of the preferred signature handler, which will be used to validate current signature. More...
 
String^ GetPreferredSubFilter ()
 Get the sub-filter name of the preferred signature handler, which will be used to validate current signature. More...
 
void SetPreferredFilter (String^ filter)
 Set the filter name, which will be used for choosing a registered signature handler for current signature. More...
 
void SetPreferredSubFilter (String^ subfilter)
 Set the sub-filter name, which will be used for choosing a registered signature handler for current signature. More...
 
UInt32 GetAnnotFlags ()
 Get annotation flags. More...
 
void SetAnnotFlags (UInt32 flags)
 Set annotation flags. More...
 
UInt32 GetAppearanceFlags ()
 Get signature appearance flags. More...
 
void SetAppearanceFlags (UInt32 apFlags)
 Set signature appearance flags. More...
 
String^ GetSigner ()
 Get signer name. More...
 
void SetSigner (String^ signer)
 Set signer name. More...
 
DateTimeGetSigningTime ()
 Get time of signing. More...
 
String^ GetLocation ()
 Get location information of the signature owner. More...
 
void SetLocation (String^ location)
 Set location information, such as CPU host name or physical location. More...
 
String^ GetReason ()
 Get the signing reason. More...
 
void SetReason (String^ reason)
 Set the signing reason. More...
 
String^ GetContactInfo ()
 Get contact information. More...
 
void SetContactInfo (String^ contactInfo)
 Set contact information. More...
 
String^ GetDistinguishedName ()
 Get distinguished name of the signature owner. More...
 
void SetDistinguishedName (String^ dn)
 Set distinguished name of the signer. More...
 
String^ GetText ()
 Get the text content shown for the appearance. More...
 
void SetText (String^ text)
 Set the text content. More...
 
void SetBitmap (PixelSource^ pixelSource)
 Set a bitmap for the signature appearance. More...
 
Int32 CountCerts ()
 Count certificates in the certificate chain of current signature. More...
 
String^ GetCert (Int32 index)
 Get a signature certificate name from certificate chain of current signature. More...
 
void SetCertChain (const List< String^ >^certChain)
 Set a certificate chain. More...
 

Properties

Int64 pointer
 Pointer to a handle of PDF signature object. This pointer is not useful outside this SDK. The application should not access the pointer to the handle of the PDF signature object directly.
 

Detailed Description

Class to represent PDF signature.

A digital signature (PDF 1.3) can be used to authenticate the identity of a user and the document’s contents.

Member Function Documentation

void Foxit::PDF::Signature::ClearData ( )

Clear signature data and appearance.

Usually, this function is called to clear signed signature data and appearance.

Returns
None.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
Int32 Foxit::PDF::Signature::CountCerts ( )

Count certificates in the certificate chain of current signature.

If current preferred sub-filter is "adbe.x509.rsa_sha1", application needs to get verified public certificate before verifying signature by calling this function and function Signature::GetCert.

Returns
The count of certificates.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
UInt32 Foxit::PDF::Signature::GetAnnotFlags ( )

Get annotation flags.

A signature field is also a widget annotations, so a signature field can hava annotation flags.

Returns
Value of annotation flags. Please refer to enumeration Annotations::Flags and this would be one or combination of its values.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
UInt32 Foxit::PDF::Signature::GetAppearanceFlags ( )

Get signature appearance flags.

Signature appearance flags indicate which information will be shown.

Returns
Value of signature appearance flags. Please refer to enumeration PDF::SigAppearanceFlags and this would be one or combination of its values.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::Signature::GetCert ( Int32  index)

Get a signature certificate name from certificate chain of current signature.

If current preferred sub-filter is "adbe.x509.rsa_sha1", application needs to get verified public certificate before verifying signature by calling this function and function Signature::CountCerts.

Parameters
[in]indexA zero-based index of annotation to be got. Range: 0 to (certCount-1). certCount is returned by function Signature::CountCerts.
Returns
A String object that receives the specified certificate name.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::NotFound means parameter index is out of range.
ErrorCode::OutOfMemory means there is not enough memory or if the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::Signature::GetContactInfo ( )

Get contact information.

Contact information provides methods about how to contact the signer. It can include mail, telephone etc.

Returns
A String object that receives the contact information.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::OutOfMemory means there is no enough memory or the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::Signature::GetDistinguishedName ( )

Get distinguished name of the signature owner.

Returns
A String object that receives the distinguished name.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::OutOfMemory means there is no enough memory or the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::Signature::GetLocation ( )

Get location information of the signature owner.

Location information of signer can be the host, MAC address, or a specific physical address. For example "FZ".

Returns
A String object that receives the location information.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::OutOfMemory means there is no enough memory or the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
Int32 Foxit::PDF::Signature::GetPageIndex ( )

Get the index of a PDF page which contains current signature.

Returns
A integer value that receives the PDF page index.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::Signature::GetPreferredFilter ( )

Get the filter name of the preferred signature handler, which will be used to validate current signature.

Returns
A String object that receives the filter name.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::OutOfMemory means there is no enough memory or the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::Signature::GetPreferredSubFilter ( )

Get the sub-filter name of the preferred signature handler, which will be used to validate current signature.

Sub-filter is used to describe the encoding used for signature value and key information.

Returns
A String object that receives the sub-filter name.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::OutOfMemory means there is no enough memory or the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::Signature::GetReason ( )

Get the signing reason.

Returns
A String object that receives the signing reason.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::OutOfMemory means there is no enough memory or the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::Signature::GetSigner ( )

Get signer name.

Returns
A String object that receives the signer name.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::OutOfMemory means there is no enough memory or the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
DateTime ^ Foxit::PDF::Signature::GetSigningTime ( )

Get time of signing.

Returns
A Foxit::DateTime object that receives the signing time.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::NotFound means no signing time property can be found.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
SigState Foxit::PDF::Signature::GetState ( )

Get current state after current signature is verified by Foxit PDF SDK.

This function is only useful if a signature has just been verified by Foxit PDF SDK. For other cases, this function is useless and the returned state is helpless.

Returns
The value of signature state. Please refer to enumeration PDF::SigState and this would be one of its values.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
String ^ Foxit::PDF::Signature::GetText ( )

Get the text content shown for the appearance.

Returns
A String object that receives the text content.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::OutOfMemory means there is no enough memory or the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
Boolean Foxit::PDF::Signature::IsSigned ( )

Check whether current signature is signed or not.

Returns
A boolean value: true means current signature is singed, while false means current signature has not been signed yet.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
Boolean Foxit::PDF::Signature::ResetAppearanceStream ( )

Reset the appearance stream if current signature is still unsigned.

This function can only be used to signature object which is unsigned.

Returns
A boolean value: true means success, while false means failure.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::UnknownState means current signature is not unsigned so cannot be reset appearance stream.
ErrorCode::OutOfMemory means there is no enough memory or the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetAnnotFlags ( UInt32  flags)

Set annotation flags.

A signature field is also a widget annotations, so a signature field can hava annotation flags.

Parameters
[in]flagsValue of flags. Please refer to enumeration Annotations::Flags and this can be one or combination of its values.
Returns
None.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetAppearanceFlags ( UInt32  apFlags)

Set signature appearance flags.

Signature appearance flags indicate which information will be shown.

Parameters
[in]apFlagsValue of signature appearance flags. Please refer to enumeration PDF::SigAppearanceFlags and this can be one or combination of its values.
Returns
None.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetBitmap ( PixelSource pixelSource)

Set a bitmap for the signature appearance.

Among the supported format defined in comment PixelSource::Format, this function does not support 16bpp rbg565 or 32bpp rgbx currently.

Parameters
[in]pixelSourceA Foxit::PixelSource object that specifies the bitmap data. Please ensure all the properties of this object are valid.
Returns
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Param means parameter pixelSource is nullptr or some members (except PixelSource::Format) of pixelSource are invalid.
ErrorCode::Unsupported means the value of PixelSource::Format in pixelSource is not one of the supported format defined in comment of PixelSource::Format, or PixelSource::Format in pixelSource represents 16bpp rbg565 or 32bpp rgbx.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetCertChain ( const List< String^ >^  certChain)

Set a certificate chain.

If current preferred sub-filter is "adbe.x509.rsa_sha1", application needs to set the certificate chain.

Parameters
[in]certChainA String array that specifies the certificate chain to be set. It should be valid and contains at least one valid element.
Returns
None.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Param means parameter certChain is nullptr or an empty array.
ErrorCode::OutOfMemory means there is not enough memory or if the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetContactInfo ( String^  contactInfo)

Set contact information.

Contact information provides methods about how to contact the signer. It can include mail, telephone etc.

Parameters
[in]contactInfoA String object that specifies the contact information.
Returns
None.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetDistinguishedName ( String^  dn)

Set distinguished name of the signer.

Parameters
[in]dnA String object that specifies the distinguished name.
Returns
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetLocation ( String^  location)

Set location information, such as CPU host name or physical location.

Location information of signer can be the host, MAC address, or a specific physical address. For example "FZ".

Parameters
[in]locationA String object that specifies the location information.
Returns
None.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetPreferredFilter ( String^  filter)

Set the filter name, which will be used for choosing a registered signature handler for current signature.

Parameters
[in]filterA String object that specifies the filter name. This should be valid, and cannot be nullptr or empty.
Returns
None.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Param means parameter filter is nullptr or empty.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetPreferredSubFilter ( String^  subfilter)

Set the sub-filter name, which will be used for choosing a registered signature handler for current signature.

Parameters
[in]subfilterA String object that specifies the sub-filter name.
Returns
None.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetReason ( String^  reason)

Set the signing reason.

Parameters
[in]reasonA String object that specifies the signing reason.
Returns
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetSigner ( String^  signer)

Set signer name.

Parameters
[in]signerA String object that specifies the signer name.
Returns
None.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
void Foxit::PDF::Signature::SetText ( String^  text)

Set the text content.

Parameters
[in]textA String object that specifies the text content.
Returns
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
Boolean Foxit::PDF::Signature::Sign ( Stream^  savefileStream,
Pause pause 
)

Sign a signature.

A signature object contains the filter and sub-filter name of a preferred signature handler, which will be used to sign and verify the signature. Before signing a signature, application should ensure that the preferred signature handler has been registered by calling function Library::RegisterSignatureHandler.

Parameters
[in]savefileStreamA Stream object that specifies the PDF document to save the signing result. Currently, only support FileStream. User should ensure this stream can be written and should close this stream after signing process is finished.
[in]pause(Reserved, should be nullptr currently) A Foxit::Pause object that specifies the pause control for signing a signature in progressive process.
Returns
A boolean value: true means success, while false means failure.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::Param means parameter savefileStream is nullptr.
ErrorCode::UnknownState means current signature has not been signed yet.
ErrorCode::UnknownHandler means the preferred signature handler of parameter signature has not been registered yet.
ErrorCode::OutOfMemory means there is not enough memory or if the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.
Boolean Foxit::PDF::Signature::Verify ( Pause pause)

Verify a signature.

A signature object contains the filter and sub-filter name of a preferred signature handler, which will be used to sign and verify the signature. Before verifying a signature, application should ensure that the preferred signature handler has been registered by calling function Library::RegisterSignatureHandler.

Parameters
[in]pause(Reserved, should be nullptr currently) A Foxit::Pause object that specifies the pause control for verifying a signature in progressive process.
Returns
A boolean value: true means success, while false means failure.
Call function Library::GetLastError after this function returns, to get the error code.
ErrorCode::Success means success.
ErrorCode::UnknownState means current signature has not been signed yet.
ErrorCode::UnknownHandler means the preferred signature handler of parameter signature has not been registered yet.
ErrorCode::OutOfMemory means there is not enough memory or if the memory access is wrong.
ErrorCode::Error means the function fails because of any other reasons.
For more error code values, please refer to enumeration Foxit::ErrorCode.

Foxit Corporation