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

Public Member Functions

java.lang.Object createContext (String filter, String sub_filter, String encrypt_info)
 A callback function used to create context for encryption and decryption. More...
 
byte [] decryptData (java.lang.Object decryptor, byte[] encrypted_data)
 A callback function used to decrypt the encrypted data. More...
 
boolean encryptData (java.lang.Object context, int obj_num, int gen_num, byte[] src_data, byte[] out_dst_buffer)
 A callback function used to get encrypted data. More...
 
byte [] finishDecryptor (java.lang.Object decryptor)
 A callback function used to finish the decryption. More...
 
int getCipher (java.lang.Object context)
 A callback function used to get the cipher type. More...
 
int getDecryptedSize (java.lang.Object context, int src_data_size)
 A callback function used to get the estimated decrypted data size. More...
 
int getEncryptedSize (java.lang.Object context, int obj_num, int gen_num, byte[] src_data)
 A callback function used to get the estimated encrypted size. More...
 
byte [] getEncryptKey (java.lang.Object context)
 A callback function used to get the encryption key. More...
 
int getSecurityType ()
 Get the encryption type of security callback. More...
 
int getUserPermissions (java.lang.Object context, int user_permission)
 A callback function used to get the user permissions. More...
 
boolean isOwner (java.lang.Object context)
 A callback function used to check if current user is the owner of the PDF document. More...
 
boolean releaseContext (java.lang.Object context)
 A callback function used to release the context for encryption and decryption. More...
 
java.lang.Object startDecryptor (java.lang.Object context, int obj_num, int gen_num)
 A callback function used to start a decryption. More...
 
- Public Member Functions inherited from com.foxit.sdk.pdf.SecurityCallback
int getSecurityType ()
 Get the encryption type of security callback. More...
 
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()

java.lang.Object com.foxit.sdk.pdf.CustomSecurityCallback.createContext ( String  filter,
String  sub_filter,
String  encrypt_info 
)

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()

byte[] com.foxit.sdk.pdf.CustomSecurityCallback.decryptData ( java.lang.Object  decryptor,
byte []  encrypted_data 
)

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.
Note
User should implement this callback function.
Returns
The decrypted data content.

◆ encryptData()

boolean com.foxit.sdk.pdf.CustomSecurityCallback.encryptData ( java.lang.Object  context,
int  obj_num,
int  gen_num,
byte []  src_data,
byte []  out_dst_buffer 
)

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.
out_dst_bufferOutput parameter that receives the encrypted content.
Note
User should implement this callback function.
Returns
true means success, while false means failure.

◆ finishDecryptor()

byte[] com.foxit.sdk.pdf.CustomSecurityCallback.finishDecryptor ( java.lang.Object  decryptor)

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()

int com.foxit.sdk.pdf.CustomSecurityCallback.getCipher ( java.lang.Object  context)

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 values starting from e_CipherNone and this should be one of these values.

◆ getDecryptedSize()

int com.foxit.sdk.pdf.CustomSecurityCallback.getDecryptedSize ( java.lang.Object  context,
int  src_data_size 
)

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 com.foxit.sdk.pdf.CustomSecurityCallback.getEncryptedSize ( java.lang.Object  context,
int  obj_num,
int  gen_num,
byte []  src_data 
)

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.
Note
User should implement this callback function.
Returns
The estimated encrypted size.

◆ getEncryptKey()

byte[] com.foxit.sdk.pdf.CustomSecurityCallback.getEncryptKey ( java.lang.Object  context)

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()

int com.foxit.sdk.pdf.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 e_EncryptCustom.

◆ getUserPermissions()

int com.foxit.sdk.pdf.CustomSecurityCallback.getUserPermissions ( java.lang.Object  context,
int  user_permission 
)

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 values starting from 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 e_PermPrint and this should be one or combination of these values.

◆ isOwner()

boolean com.foxit.sdk.pdf.CustomSecurityCallback.isOwner ( java.lang.Object  context)

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()

boolean com.foxit.sdk.pdf.CustomSecurityCallback.releaseContext ( java.lang.Object  context)

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()

java.lang.Object com.foxit.sdk.pdf.CustomSecurityCallback.startDecryptor ( java.lang.Object  context,
int  obj_num,
int  gen_num 
)

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.