Foxit PDF SDK
<FSCustomSecurityCallback> Protocol Reference
Inheritance diagram for <FSCustomSecurityCallback>:
<FSSecurityCallback> <FSRMSSecurityCallback>

Instance Methods

(void *) - createContext:sub_filter:encrypt_info:
 A callback function used to create context for encryption and decryption. More...
 
(NSData *) - decryptData:encrypted_data:encrypted_data_len:
 A callback function used to decrypt the encrypted data. More...
 
(BOOL) - encryptData: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...
 
(NSData *) - finishDecryptor:
 A callback function used to finish the decryption. More...
 
(FSSecurityHandlerCipherType- getCipher:
 A callback function used to get the cipher type. More...
 
(unsigned int) - getDecryptedSize:src_data_size:
 A callback function used to get the estimated decrypted data size. More...
 
(unsigned int) - getEncryptedSize:obj_num:gen_num:src_data:src_data_len:
 A callback function used to get the estimated encrypted size. More...
 
(NSData *) - getEncryptKey:
 A callback function used to get the encryption key. More...
 
(unsigned int) - getUserPermissions:user_permission:
 A callback function used to get the user permissions. More...
 
(BOOL) - isOwner:
 A callback function used to check if current user is the owner of the PDF document. More...
 
(BOOL) - releaseContext:
 A callback function used to release the context for encryption and decryption. More...
 
(void *) - startDecryptor:obj_num:gen_num:
 A callback function used to start a decryption. More...
 
(BOOL) - useStandardCryptoMethod:
 A callback function to check if to use stanard crypto method or custom crypto method. More...
 
- Instance Methods inherited from <FSSecurityCallback>
(FSPDFDocEncryptType- GetSecurityType
 Get the encryption type of security callback. 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 FSLibrary::registerSecurityCallback:callback: with with any custom filter name (following the PDF name conventions). Function FSLibrary::unregisterSecurityCallback: can be called to unregister the security callback object with the registered filter name.

Method Documentation

◆ createContext:sub_filter:encrypt_info:()

- (void *) createContext: (NSString *)  filter
sub_filter: (NSString *)  sub_filter
encrypt_info: (NSString *)  encrypt_info 
required

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:encrypted_data:encrypted_data_len:()

- (NSData*) decryptData: (void *)  decryptor
encrypted_data: (void *)  encrypted_data
encrypted_data_len: (unsigned int)  encrypted_data_len 
required

A callback function used to decrypt the encrypted data.

Parameters
[in]decryptorThe decryptor implemented and created by user, returned by callback function FSCustomSecurityCallback::startDecryptor:obj_num:gen_num:.
[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:obj_num:gen_num:src_data:src_data_len:out_dst_buffer:out_dst_buffer_len:()

- (BOOL) encryptData: (void *)  context
obj_num: (int)  obj_num
gen_num: (int)  gen_num
src_data: (void *)  src_data
src_data_len: (unsigned int)  src_data_len
out_dst_buffer: (void *)  out_dst_buffer
out_dst_buffer_len: (unsigned int *)  out_dst_buffer_len 
required

A callback function used to get encrypted data.

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FSCustomSecurityCallback::createContext:sub_filter:encrypt_info:.
[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 used to receives the encrypted content.
[out]out_dst_buffer_lenOutput parameter used to received the length of the encrypted data.
Note
User should implement this callback function.
Returns
YES means success, while NO means failure.

◆ finishDecryptor:()

- (NSData *) finishDecryptor: (void *)  decryptor
required

A callback function used to finish the decryption.

Parameters
[in]decryptorThe decryptor implemented and created by user, returned by callback function FSCustomSecurityCallback::startDecryptor:obj_num:gen_num:.
Note
User should implement this callback function.
Returns
The decrypted data content.

◆ getCipher:()

- (FSSecurityHandlerCipherType) getCipher: (void *)  context
required

A callback function used to get the cipher type.

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FSCustomSecurityCallback::createContext:sub_filter:encrypt_info:.
Note
User should implement this callback function.
Returns
The cipher type. Please refer to values starting from FSSecurityHandlerCipherNone and this should be one of these values.

◆ getDecryptedSize:src_data_size:()

- (unsigned int) getDecryptedSize: (void *)  context
src_data_size: (unsigned int)  src_data_size 
required

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

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FSCustomSecurityCallback::createContext:sub_filter:encrypt_info:.
[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:obj_num:gen_num:src_data:src_data_len:()

- (unsigned int) getEncryptedSize: (void *)  context
obj_num: (int)  obj_num
gen_num: (int)  gen_num
src_data: (void *)  src_data
src_data_len: (unsigned int)  src_data_len 
required

A callback function used to get the estimated encrypted size.

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

- (NSData *) getEncryptKey: (void *)  context
required

A callback function used to get the encryption key.

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FSCustomSecurityCallback::createContext:sub_filter:encrypt_info:.
Note
User should implement this callback function.
Returns
The encryption key.

◆ getUserPermissions:user_permission:()

- (unsigned int) getUserPermissions: (void *)  context
user_permission: (FSPDFDocUserPermissions user_permission 
required

A callback function used to get the user permissions.

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FSCustomSecurityCallback::createContext:sub_filter:encrypt_info:.
[in]user_permissionOriginal permission settings of the document. Please refer to values starting from FSPDFDocPermPrint 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 FSPDFDocPermPrint and this should be one or combination of these values.

◆ isOwner:()

- (BOOL) isOwner: (void *)  context
required

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 FSCustomSecurityCallback::createContext:sub_filter:encrypt_info:.
Note
User should implement this callback function.
Returns
YES means current user is the owner, and NO means current user is not the owner.

◆ releaseContext:()

- (BOOL) releaseContext: (void *)  context
required

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

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FSCustomSecurityCallback::createContext:sub_filter:encrypt_info:.
Note
User should implement this callback function.
Returns
YES means success, while NO means failure.

◆ startDecryptor:obj_num:gen_num:()

- (void *) startDecryptor: (void *)  context
obj_num: (int)  obj_num
gen_num: (int)  gen_num 
required

A callback function used to start a decryption.

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

- (BOOL) useStandardCryptoMethod: (void *)  context
required

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

Parameters
[in]contextThe context for encryption and decryption, returned by callback function FSCustomSecurityCallback::createContext:sub_filter:encrypt_info:.
Returns