Aspose::Pdf::Facades::PdfFileSecurity::MfEncryptFile method

PdfFileSecurity::MfEncryptFile(System::String, System::String, System::SharedPtr<DocumentPrivilege>, KeySize) method

Encrypts Pdf file with userpassword and ownerpassword and sets the document’s privileges to access. The user password and the owner password can be null or empty. The owner password will be replaced with a random string if the input owner password is null or empty. Throws exception if process failed.

bool Aspose::Pdf::Facades::PdfFileSecurity::MfEncryptFile(System::String userPassword, System::String ownerPassword, System::SharedPtr<DocumentPrivilege> privilege, KeySize keySize)
ParameterTypeDescription
userPasswordSystem::StringUser password.
ownerPasswordSystem::StringOwner password.
privilegeSystem::SharedPtr<DocumentPrivilege>Set privilege.
keySizeKeySizeKeySize.x40 for 40 bits encryption, KeySize.x128 for 128 bits encryption and KeySize.x256 for 256 bits encryption.

ReturnValue

True for success.

See Also

PdfFileSecurity::MfEncryptFile(System::String, System::String, System::SharedPtr<DocumentPrivilege>, KeySize, Algorithm) method

Encrypts Pdf file with userpassword and ownerpassword and sets the document’s privileges to access. The user password and the owner password can be null or empty. The owner password will be replaced with a random string if the input owner password is null or empty. There are 6 possible combinations of KeySize and Algorithm values. However (KeySize.x40, Algorithm.AES) and (KeySize.x256, Algorithm.RC4) are invalid and corresponding exception will be raised if kit encounters this combination. Throws an exception if process failed.

bool Aspose::Pdf::Facades::PdfFileSecurity::MfEncryptFile(System::String userPassword, System::String ownerPassword, System::SharedPtr<DocumentPrivilege> privilege, KeySize keySize, Algorithm cipher)
ParameterTypeDescription
userPasswordSystem::StringUser password.
ownerPasswordSystem::StringOwner password.
privilegeSystem::SharedPtr<DocumentPrivilege>Set privilege.
keySizeKeySizeKeySize.x40 for 40 bits encryption, KeySize.x128 for 128 bits encryption and KeySize.x256 for 256 bits encryption.
cipherAlgorithmAlgorithm.AES to encrypt using AES algorithm or Algorithm.RC4 for RC4 encryption.

ReturnValue

True for success.

See Also