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

Public Types

enum  ModifyFlag { ModifyFlag.e_ModifyPermission = 0x01, ModifyFlag.e_ModifyUserPassword = 0x02, ModifyFlag.e_ModifyOwnerPassword = 0x04 }
 (Only for AES-256) Enumeration for modify flag used to decide which security data or password will be modified during encryption process
More...
 
- Public Types inherited from foxit.pdf.SecurityHandler
enum  CipherType { CipherType.e_CipherNone = 0, CipherType.e_CipherRC4 = 1, CipherType.e_CipherAES = 2 }
 Enumeration for Encryption Algorithm.
More...
 

Public Member Functions

 StdSecurityHandler ()
 Constructor.

 
 StdSecurityHandler (SecurityHandler other)
 Constructor, with parent class object.
More...
 
bool Initialize (StdEncryptData encrypt_data, byte[] user_password, byte[] owner_password)
 (Not support AES-256) Initialize current standard security handler.
More...
 
bool InitializeW (StdEncryptData encrypt_data, string user_password, string owner_password)
 (Only for AES-256) Initialize current standard security handler.
More...
 
void SetAES256ModifyFlags (int modify_flags)
 (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 foxit.pdf.SecurityHandler
 SecurityHandler ()
 Constructor.

 
 SecurityHandler (SecurityHandler other)
 Constructor, with another security handler object.
More...
 
virtual PDFDoc.EncryptType GetSecurityType ()
 Get the encryption type of current security handler.
More...
 
bool IsEmpty ()
 Check whether current object is empty or not.
More...
 

Detailed Description

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

See also
SecurityHandler

Member Enumeration Documentation

◆ ModifyFlag

(Only for AES-256) Enumeration for modify flag used to decide which security data or password will be modified during encryption process

Values of this enumeration can be used alone or in combination.

Enumerator
e_ModifyPermission 

If set, user permissions and "is encrypt metadata" values (which are defined in StdEncryptData ) will be modified during encryption process.

e_ModifyUserPassword 

If set, user password and owner password will be modified during encryption process.

e_ModifyOwnerPassword 

If set, only owner password will be modified during encryption process.

Constructor & Destructor Documentation

◆ StdSecurityHandler()

foxit.pdf.StdSecurityHandler.StdSecurityHandler ( SecurityHandler  other)
inline

Constructor, with parent class object.

Parameters
[in]otherParent class object.

Member Function Documentation

◆ Initialize()

bool foxit.pdf.StdSecurityHandler.Initialize ( StdEncryptData  encrypt_data,
byte []  user_password,
byte []  owner_password 
)
inline

(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 foxit.pdf.SecurityHandler.CipherType.e_CipherNone , or foxit.pdf.SecurityHandler.CipherType.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()

bool foxit.pdf.StdSecurityHandler.InitializeW ( StdEncryptData  encrypt_data,
string  user_password,
string  owner_password 
)
inline

(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 foxit.pdf.SecurityHandler.CipherType.e_CipherAES and key length should be 32.
Returns
true means success, while false means failure.

◆ SetAES256ModifyFlags()

void foxit.pdf.StdSecurityHandler.SetAES256ModifyFlags ( int  modify_flags)
inline

(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 foxit.pdf.StdSecurityHandler.ModifyFlag.e_ModifyPermission and this should be one or combination of these values.
Returns
None.