Foxit PDF SDK
FoxitPDFSDKPython2.CustomSecurityCallback Class Reference
Inheritance diagram for FoxitPDFSDKPython2.CustomSecurityCallback:
FoxitPDFSDKPython2.SecurityCallback FoxitPDFSDKPython2.RMSSecurityCallback

Public Member Functions

def CreateContext (filter, sub_filter, encrypt_info)
 A callback function used to create context for encryption and decryption. More...
 
def DecryptData (decryptor, encrypted_data, encrypted_data_len)
 A callback function used to decrypt the encrypted data. More...
 
def EncryptData (context, obj_num, gen_num, src_data, src_data_len, out_dst_buffer, out_dst_buffer_len)
 A callback function used to get encrypted data. More...
 
def FinishDecryptor (decryptor)
 A callback function used to finish the decryption. More...
 
def GetCipher (context)
 A callback function used to get the cipher type. More...
 
def GetDecryptedSize (context, src_data_size)
 A callback function used to get the estimated decrypted data size. More...
 
def GetEncryptedSize (context, obj_num, gen_num, src_data, src_data_len)
 A callback function used to get the estimated encrypted size. More...
 
def GetEncryptKey (context)
 A callback function used to get the encryption key. More...
 
def GetSecurityType ()
 Get the encryption type of security callback. More...
 
def GetUserPermissions (context, user_permission)
 A callback function used to get the user permissions. More...
 
def IsOwner (context)
 A callback function used to check if current user is the owner of the PDF document. More...
 
def ReleaseContext (context)
 A callback function used to release the context for encryption and decryption. More...
 
def StartDecryptor (context, obj_num, gen_num)
 A callback function used to start a decryption. More...
 
def UseStandardCryptoMethod (context)
 A callback function to check if to use standard crypto method or custom crypto method. More...
 
- Public Member Functions inherited from FoxitPDFSDKPython2.SecurityCallback
def Release ()
 A callback function used to release current 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 FoxitPDFSDKPython2.Library.RegisterSecurityCallback with with any custom filter name (following the PDF name conventions). Function FoxitPDFSDKPython2.Library.UnregisterSecurityCallback can be called to unregister the security callback object with the registered filter name.

Member Function Documentation

◆ CreateContext()

def FoxitPDFSDKPython2.CustomSecurityCallback.CreateContext (   filter,
  sub_filter,
  encrypt_info 
)

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

Parameters
[in]filterThe filter name of the custom security callback object.
[in]sub_filterThe sub filter name that specifies the syntax of the encryption dictionary contents.
[in]encrypt_infoThe encryption information of the PDF document.
Note
User should implement this callback function.
Returns
The encryption context.

◆ DecryptData()

def FoxitPDFSDKPython2.CustomSecurityCallback.DecryptData (   decryptor,
  encrypted_data,
  encrypted_data_len 
)

A callback function used to decrypt the encrypted data.

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

◆ EncryptData()

def FoxitPDFSDKPython2.CustomSecurityCallback.EncryptData (   context,
  obj_num,
  gen_num,
  src_data,
  src_data_len,
  out_dst_buffer,
  out_dst_buffer_len 
)

A callback function used to get encrypted data.

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

◆ FinishDecryptor()

def FoxitPDFSDKPython2.CustomSecurityCallback.FinishDecryptor (   decryptor)

A callback function used to finish the decryption.

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

◆ GetCipher()

def FoxitPDFSDKPython2.CustomSecurityCallback.GetCipher (   context)

A callback function used to get the cipher type.

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FoxitPDFSDKPython2.CustomSecurityCallback.CreateContext .
Note
User should implement this callback function.
Returns
The cipher type. Please refer to values starting from FoxitPDFSDKPython2.SecurityHandler.e_CipherNone and this should be one of these values.

◆ GetDecryptedSize()

def FoxitPDFSDKPython2.CustomSecurityCallback.GetDecryptedSize (   context,
  src_data_size 
)

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

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FoxitPDFSDKPython2.CustomSecurityCallback.CreateContext .
[in]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()

def FoxitPDFSDKPython2.CustomSecurityCallback.GetEncryptedSize (   context,
  obj_num,
  gen_num,
  src_data,
  src_data_len 
)

A callback function used to get the estimated encrypted size.

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

◆ GetEncryptKey()

def FoxitPDFSDKPython2.CustomSecurityCallback.GetEncryptKey (   context)

A callback function used to get the encryption key.

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

◆ GetSecurityType()

def FoxitPDFSDKPython2.CustomSecurityCallback.GetSecurityType ( )

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 FoxitPDFSDKPython2.PDFDoc.e_EncryptCustom .

Reimplemented from FoxitPDFSDKPython2.SecurityCallback.

Reimplemented in FoxitPDFSDKPython2.RMSSecurityCallback.

◆ GetUserPermissions()

def FoxitPDFSDKPython2.CustomSecurityCallback.GetUserPermissions (   context,
  user_permission 
)

A callback function used to get the user permissions.

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FoxitPDFSDKPython2.CustomSecurityCallback.CreateContext .
[in]user_permissionOriginal permission settings of the document. Please refer to values starting from FoxitPDFSDKPython2.PDFDoc.e_PermPrint and this would be one or combination of these values.
Note
User should implement this callback function.
Returns
The new user permissions. Please refer to values starting from FoxitPDFSDKPython2.PDFDoc.e_PermPrint and this should be one or combination of these values.

◆ IsOwner()

def FoxitPDFSDKPython2.CustomSecurityCallback.IsOwner (   context)

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

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FoxitPDFSDKPython2.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()

def FoxitPDFSDKPython2.CustomSecurityCallback.ReleaseContext (   context)

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

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

◆ StartDecryptor()

def FoxitPDFSDKPython2.CustomSecurityCallback.StartDecryptor (   context,
  obj_num,
  gen_num 
)

A callback function used to start a decryption.

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

◆ UseStandardCryptoMethod()

def FoxitPDFSDKPython2.CustomSecurityCallback.UseStandardCryptoMethod (   context)

A callback function to check if to use standard crypto method or custom crypto method.

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FoxitPDFSDKPython2.CustomSecurityCallback.CreateContext .
Returns
<ul>
<li>
<b>true</b> means to use standard crypto method. In this case, callback functions @link
FoxitPDFSDKPython2::CustomSecurityCallback::GetDecryptedSize
FoxitPDFSDKPython2.CustomSecurityCallback.GetDecryptedSize @endlink, @link
FoxitPDFSDKPython2::CustomSecurityCallback::StartDecryptor FoxitPDFSDKPython2.CustomSecurityCallback.StartDecryptor
@endlink, @link FoxitPDFSDKPython2::CustomSecurityCallback::DecryptData
FoxitPDFSDKPython2.CustomSecurityCallback.DecryptData @endlink, @link
FoxitPDFSDKPython2::CustomSecurityCallback::FinishDecryptor
FoxitPDFSDKPython2.CustomSecurityCallback.FinishDecryptor @endlink, @link
FoxitPDFSDKPython2::CustomSecurityCallback::GetEncryptedSize
FoxitPDFSDKPython2.CustomSecurityCallback.GetEncryptedSize @endlink, and @link
FoxitPDFSDKPython2::CustomSecurityCallback::EncryptData FoxitPDFSDKPython2.CustomSecurityCallback.EncryptData
@endlink will be uselss and user can just use empty implementation for them.  
</li>
<li>
<b>false</b> means use custom crypto method. In this case, please ensure callback functions mentioned above have all
been implemented.  
</li>
</ul>