foxit.pdf.CustomSecurityCallback Class Reference
Inheritance diagram for foxit.pdf.CustomSecurityCallback:
foxit.pdf.SecurityCallback foxit.pdf.RMSSecurityCallback

Public Member Functions

virtual global::System.IntPtr CreateContext (string filter, string sub_filter, string encrypt_info)
 A callback function used to create context for encryption and decryption.
More...
 
virtual System.IntPtr DecryptData (global::System.IntPtr decryptor, global::System.IntPtr encrypted_data, int encrypted_data_len)
 A callback function used to decrypt the encrypted data.
More...
 
virtual bool EncryptData (global::System.IntPtr context, int obj_num, int gen_num, global::System.IntPtr src_data, int src_data_len, global::System.IntPtr out_dst_buffer, out int out_dst_buffer_len)
 A callback function used to get encrypted data.
More...
 
virtual string FinishDecryptor (global::System.IntPtr decryptor)
 A callback function used to finish the decryption.
More...
 
virtual SecurityHandler.CipherType GetCipher (global::System.IntPtr context)
 A callback function used to get the cipher type.
More...
 
virtual int GetDecryptedSize (global::System.IntPtr context, int src_data_size)
 A callback function used to get the estimated decrypted data size.
More...
 
virtual int GetEncryptedSize (global::System.IntPtr context, int obj_num, int gen_num, global::System.IntPtr src_data, int src_data_len)
 A callback function used to get the estimated encrypted size.
More...
 
virtual string GetEncryptKey (global::System.IntPtr context)
 A callback function used to get the encryption key.
More...
 
override PDFDoc.EncryptType GetSecurityType ()
 Get the encryption type of security callback.
More...
 
virtual int GetUserPermissions (global::System.IntPtr context, int user_permission)
 A callback function used to get the user permissions.
More...
 
virtual bool IsOwner (global::System.IntPtr context)
 A callback function used to check if current user is the owner of the PDF document.
More...
 
virtual bool ReleaseContext (global::System.IntPtr context)
 A callback function used to release the context for encryption and decryption.
More...
 
virtual global::System.IntPtr StartDecryptor (global::System.IntPtr context, int obj_num, int gen_num)
 A callback function used to start a decryption.
More...
 
- Public Member Functions inherited from foxit.pdf.SecurityCallback
virtual void Release ()
 A callback function used to release current security callback object itself.
More...
 

Detailed Description

This class represents a callback object for custom decryption and encryption. If user wants to use custom security callback, user should inherit this callback class and implement the pure virtual functions (as callback functions), and then register the custom security callback object to Foxit PDF SDK by function common::Library::RegisterSecurityCallback with with any custom filter name (following the PDF name conventions). Function common::Library::UnregisterSecurityCallback can be called to unregister the security callback object with the registered filter name.

Member Function Documentation

◆ CreateContext()

global.System.IntPtr foxit.pdf.CustomSecurityCallback.CreateContext ( string  filter,
string  sub_filter,
string  encrypt_info 
)
inlinevirtual

A callback function used to create context for encryption and decryption.

Parameters
filterThe encryption filter of the PDF document.
sub_filterThe sub filter of the PDF document.
encrypt_infoThe encryption information of the PDF document.
Note
User should implement this callback function.
Returns
The encryption context.

◆ DecryptData()

System.IntPtr foxit.pdf.CustomSecurityCallback.DecryptData ( global::System.IntPtr  decryptor,
global::System.IntPtr  encrypted_data,
int  encrypted_data_len 
)
inlinevirtual

A callback function used to decrypt the encrypted data.

Parameters
decryptorThe decryptor implemented and created by user, returned by callback function CustomSecurityCallback::StartDecryptor.
encrypted_dataThe buffer which stores the encrypted data.
encrypted_data_lenThe length of encrypted data, in bytes.
Note
User should implement this callback function.
Returns
The decrypted data content.

◆ EncryptData()

bool foxit.pdf.CustomSecurityCallback.EncryptData ( global::System.IntPtr  context,
int  obj_num,
int  gen_num,
global::System.IntPtr  src_data,
int  src_data_len,
global::System.IntPtr  out_dst_buffer,
out int  out_dst_buffer_len 
)
inlinevirtual

A callback function used to get encrypted data.

Parameters
contextThe context for encryption and decryption, returned by callback function CustomSecurityCallback::CreateContext.
obj_numThe object number for a PDF object.
gen_numThe generation number for a PDF object.
src_dataThe buffer which stores the plain text to be encrypted.
src_data_lenThe length of the buffer.
out_dst_bufferOutput parameter used to receives the encrypted content.
out_dst_buffer_lenOutput parameter used to received the length of the encrypted data.
Note
User should implement this callback function.
Returns
true means success, while false means failure.

◆ FinishDecryptor()

string foxit.pdf.CustomSecurityCallback.FinishDecryptor ( global::System.IntPtr  decryptor)
inlinevirtual

A callback function used to finish the decryption.

Parameters
decryptorThe decryptor implemented and created by user, returned by callback function CustomSecurityCallback::StartDecryptor.
Note
User should implement this callback function.
Returns
The decrypted data content.

◆ GetCipher()

SecurityHandler.CipherType foxit.pdf.CustomSecurityCallback.GetCipher ( global::System.IntPtr  context)
inlinevirtual

A callback function used to get the cipher type.

Parameters
contextThe context for encryption and decryption, returned by callback function CustomSecurityCallback::CreateContext.
Note
User should implement this callback function.
Returns
The cipher type. Please refer to e_CipherXXX values and this should be one or combination of its values.

◆ GetDecryptedSize()

int foxit.pdf.CustomSecurityCallback.GetDecryptedSize ( global::System.IntPtr  context,
int  src_data_size 
)
inlinevirtual

A callback function used to get the estimated decrypted data size.

Parameters
contextThe context for encryption and decryption, returned by callback function CustomSecurityCallback::CreateContext.
src_data_sizeSize of source data which is to be decrypted.
Note
User should implement this callback function.
Returns
The estimated decrypted data size.

◆ GetEncryptedSize()

int foxit.pdf.CustomSecurityCallback.GetEncryptedSize ( global::System.IntPtr  context,
int  obj_num,
int  gen_num,
global::System.IntPtr  src_data,
int  src_data_len 
)
inlinevirtual

A callback function used to get the estimated encrypted size.

Parameters
contextThe context for encryption and decryption, returned by callback function CustomSecurityCallback::CreateContext.
obj_numThe object number for a PDF object.
gen_numThe generation number for a PDF object.
src_dataThe buffer which stores the plain text to be encrypted.
src_data_lenThe length of the buffer.
Note
User should implement this callback function.
Returns
The estimated encrypted size.

◆ GetEncryptKey()

string foxit.pdf.CustomSecurityCallback.GetEncryptKey ( global::System.IntPtr  context)
inlinevirtual

A callback function used to get the encryption key.

Parameters
contextThe context for encryption and decryption, returned by callback function CustomSecurityCallback::CreateContext.
Note
User should implement this callback function.
Returns
The encryption key.

◆ GetSecurityType()

override PDFDoc.EncryptType foxit.pdf.CustomSecurityCallback.GetSecurityType ( )
inlinevirtual

Get the encryption type of security callback.

Note
User should not override this function, otherwise there will be unexpected behavior.
Returns
The encryption type. It would always be e_EncryptCustom.

Reimplemented from foxit.pdf.SecurityCallback.

Reimplemented in foxit.pdf.RMSSecurityCallback.

◆ GetUserPermissions()

int foxit.pdf.CustomSecurityCallback.GetUserPermissions ( global::System.IntPtr  context,
int  user_permission 
)
inlinevirtual

A callback function used to get the user permissions.

Parameters
contextThe context for encryption and decryption, returned by callback function CustomSecurityCallback::CreateContext.
user_permissionOriginal permission settings of the document. Please refer to e_PermXXX values and this whould be one or combination of its values.
Note
User should implement this callback function.
Returns
The new user permissions. Please refer to e_PermXXX values and this should be one or combination of its values.

◆ IsOwner()

bool foxit.pdf.CustomSecurityCallback.IsOwner ( global::System.IntPtr  context)
inlinevirtual

A callback function used to check if current user is the owner of the PDF document.

Parameters
contextThe context for encryption and decryption, returned by callback function CustomSecurityCallback::CreateContext.
Note
User should implement this callback function.
Returns
true means current user is the owner, and false means current user is not the owner.

◆ ReleaseContext()

bool foxit.pdf.CustomSecurityCallback.ReleaseContext ( global::System.IntPtr  context)
inlinevirtual

A callback function used to release the context for encryption and decryption.

Parameters
contextThe context for encryption and decryption, returned by callback function CustomSecurityCallback::CreateContext.
Note
User should implement this callback function.
Returns
true means success, while false means failure.

◆ StartDecryptor()

global.System.IntPtr foxit.pdf.CustomSecurityCallback.StartDecryptor ( global::System.IntPtr  context,
int  obj_num,
int  gen_num 
)
inlinevirtual

A callback function used to start a decryption.

Parameters
contextThe context for encryption and decryption, returned by callback function CustomSecurityCallback::CreateContext.
obj_numThe object number for a PDF object.
gen_numThe generation number for a PDF object.
Note
User should implement this callback function.
Returns
A decryptor implemented and created by user.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.