Foxit PDF SDK
com.foxit.sdk.pdf.StdSecurityHandler Class Reference
Inheritance diagram for com.foxit.sdk.pdf.StdSecurityHandler:
com.foxit.sdk.pdf.SecurityHandler com.foxit.sdk.common.Base

Public Member Functions

 StdSecurityHandler ()
 Constructor.
 
 StdSecurityHandler (SecurityHandler other)
 Constructor, with parent class object. More...
 
synchronized void delete ()
 Clean up related resources immediately. More...
 
boolean initialize (StdEncryptData encrypt_data, byte[] user_password, byte[] owner_password) throws com.foxit.sdk.PDFException
 (Not support AES-256) Initialize current standard security handler. More...
 
boolean initializeW (StdEncryptData encrypt_data, String user_password, String owner_password) throws com.foxit.sdk.PDFException
 (Only for AES-256) Initialize current standard security handler. More...
 
void setAES256ModifyFlags (int modify_flags) throws com.foxit.sdk.PDFException
 (Only for AES-256) Set modify flags to decide which security data or password will be modified during encryption process. More...
 
- Public Member Functions inherited from com.foxit.sdk.pdf.SecurityHandler
 SecurityHandler ()
 Constructor.
 
 SecurityHandler (SecurityHandler other)
 Constructor, with another security handler object. More...
 
synchronized void delete ()
 Clean up related resources immediately. More...
 
int getSecurityType ()
 Get the encryption type of current security handler. More...
 
boolean isEmpty ()
 Check whether current object is empty or not. More...
 
- Public Member Functions inherited from com.foxit.sdk.common.Base
synchronized void delete ()
 Clean up related resources immediately. More...
 

Static Public Attributes

static final int e_ModifyOwnerPassword = 0x04
 If set, only owner password will be modified during encryption process.
 
static final int e_ModifyPermission = 0x01
 If set, user permissions and "is encrypt metadata" values (which are defined in StdEncryptData ) will be modified during encryption process.
 
static final int e_ModifyUserPassword = 0x02
 If set, user password and owner password will be modified during encryption process.
 
- Static Public Attributes inherited from com.foxit.sdk.pdf.SecurityHandler
static final int e_CipherAES = 2
 Use AES encryption algorithm, with the key length be 16 bytes (as AES-128) or 32 bytes (as AES-256, only supported in PDF 2.0).
 
static final int e_CipherNone = 0
 Not use encryption algorithm.
 
static final int e_CipherRC4 = 1
 Use RC4 encryption algorithm, with the key length between 5 bytes and 16 bytes.
 

Detailed Description

This class represents a standard security handler, used for password encryption.

See also
SecurityHandler

Constructor & Destructor Documentation

◆ StdSecurityHandler()

com.foxit.sdk.pdf.StdSecurityHandler.StdSecurityHandler ( SecurityHandler  other)

Constructor, with parent class object.

Parameters
[in]otherParent class object.

Member Function Documentation

◆ delete()

synchronized void com.foxit.sdk.pdf.StdSecurityHandler.delete ( )

Clean up related resources immediately.

Returns
None.
Note
Once this function is called, current object cannot be used anymore.

◆ initialize()

boolean com.foxit.sdk.pdf.StdSecurityHandler.initialize ( StdEncryptData  encrypt_data,
byte []  user_password,
byte []  owner_password 
) throws com.foxit.sdk.PDFException

(Not support AES-256) Initialize current standard security handler.

Parameters
[in]user_passwordA user password, which is used to open the PDF document. This can be empty when parameter owner_password is not empty.
[in]owner_passwordAn owner password, which is used to take ownership of the PDF document. This can be empty when parameter user_password is not empty.
[in]encrypt_dataA standard encrypt data object. In the encryption data, cipher type should not be com.foxit.sdk.pdf.SecurityHandler.e_CipherNone , or com.foxit.sdk.pdf.SecurityHandler.e_CipherAES with key length 32 (that means not support AES-256). Please refer to comment of class StdEncryptData to ensure the validation of each member.
Returns
true means success, while false means failure.

◆ initializeW()

boolean com.foxit.sdk.pdf.StdSecurityHandler.initializeW ( StdEncryptData  encrypt_data,
String  user_password,
String  owner_password 
) throws com.foxit.sdk.PDFException

(Only for AES-256) Initialize current standard security handler.

Parameters
[in]user_passwordA user password, which is used to open the PDF document. This can be empty when parameter owner_password is not empty.
[in]owner_passwordAn owner password, which is used to take ownership of the PDF document. This can be empty when parameter user_password is not empty.
[in]encrypt_dataA standard encrypt data object. In the encryption data, cipher type should be com.foxit.sdk.pdf.SecurityHandler.e_CipherAES and key length should be 32.
Returns
true means success, while false means failure.

◆ setAES256ModifyFlags()

void com.foxit.sdk.pdf.StdSecurityHandler.setAES256ModifyFlags ( int  modify_flags) throws com.foxit.sdk.PDFException

(Only for AES-256) Set modify flags to decide which security data or password will be modified during encryption process.

Modify flags are useful only when a PDF document has been encrypted by AES-256 and current StdSecurityHandler object is to be used to modify some security data or password for this PDF document. For other case, these modify flags will be ignored during encryption process. Security data and passwords are set through function StdSecurityHandler::InitializeW. If this function has not been called by current StdSecurityHandler object, that means to modify all the security data and password by default.

Parameters
[in]modify_flagsModify flags used to decide which security data or password will be modified during encryption process. Please refer to values starting from com.foxit.sdk.pdf.StdSecurityHandler.e_ModifyPermission and this should be one or combination of these values.
Returns
None.