Aspose::Pdf::Facades::PdfFileSecurity class
Contents
[
Hide
]PdfFileSecurity class
Represents encrypting or decrypting a Pdf file with owner or user password, changing the security setting and password.
class PdfFileSecurity : public Aspose::Pdf::Facades::SaveableFacade
Methods
| Method | Description |
|---|---|
| BindPdf(System::String) override | Initializes the facade. |
| BindPdf(System::SharedPtr<System::IO::Stream>) override | Initializes the facade. |
| ChangePassword(const System::String&, const System::String&, const System::String&) | Changes the user password and owner password by owner password, keeps the original security settings. The new user password and the new owner password can be null or empty. The owner password will be replaced with a random string if the new owner password is null or empty. Throws an exception if process failed. |
| ChangePassword(const System::String&, const System::String&, const System::String&, const System::SharedPtr<DocumentPrivilege>&, KeySize) | Changes the user password and password by owner password, allows to reset Pdf documnent security. The new user password and the new owner password can be null or empty. The owner password will be replaced with a random string if the new owner password is null or empty. Throws an exception if process failed. |
| ChangePassword(const System::String&, const System::String&, const System::String&, const System::SharedPtr<DocumentPrivilege>&, KeySize, Algorithm) | Changes the user password and password by owner password, allows to reset Pdf documnent security. The new user password and the new owner password can be null or empty. The owner password will be replaced with a random string if the new 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. |
| Close() override | Closes the facade. |
| get_AllowExceptions() | If this value set to true, exception will be thrown on opearation failure. Else, method returns false on failure and last exception can be checked with LastException property. |
| get_LastException() const | Returns exception which was thrown by last operation. |
| MfDecryptFile(const System::String&) | Decrypts an encrypted Pdf document by owner password. If the document hasn’t owner password, it is allow to use user password. Throws an exception if process failed. |
| MfEncryptFile(const System::String&, const System::String&, const System::SharedPtr<DocumentPrivilege>&, KeySize) | 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. |
| MfEncryptFile(const System::String&, const System::String&, const System::SharedPtr<DocumentPrivilege>&, KeySize, Algorithm) | 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. |
| PdfFileSecurity(const System::SharedPtr<System::IO::Stream>&, const System::SharedPtr<System::IO::Stream>&) | Initialize the object of PdfFileSecurity with input and output stream. |
| PdfFileSecurity(const System::String&, const System::String&) | Initializes the object of PdfFileSecurity with input and output file. |
| PdfFileSecurity() | Initialize the object of PdfFileSecurity. |
| PdfFileSecurity(const System::SharedPtr<Aspose::Pdf::Document>&) | Initializes new PdfFileSecurity object on base of the document . |
| PdfFileSecurity(const System::SharedPtr<Aspose::Pdf::Document>&, const System::String&) | Initializes new PdfFileSecurity object on base of the document . |
| PdfFileSecurity(const System::SharedPtr<Aspose::Pdf::Document>&, const System::SharedPtr<System::IO::Stream>&) | Initializes new PdfFileSecurity object on base of the document . |
| set_AllowExceptions(bool) | If this value set to true, exception will be thrown on opearation failure. Else, method returns false on failure and last exception can be checked with LastException property. |
| set_InputFile(const System::String&) | Sets the input file. |
| set_InputStream(const System::SharedPtr<System::IO::Stream>&) | Sets the input stream. |
| set_OutputFile(const System::String&) | Sets the output file. |
| set_OutputStream(const System::SharedPtr<System::IO::Stream>&) | Sets the output stream. |
| SetPrivilege(const System::SharedPtr<DocumentPrivilege>&) | Sets Pdf file security with empty user/owner passwords. The owner password will be added by a random string. Throws an exception if process failed. |
| SetPrivilege(const System::String&, const System::String&, const System::SharedPtr<DocumentPrivilege>&) | Sets Pdf file security with original password. Throws an exception if process failed. |
| TryChangePassword(const System::String&, const System::String&, const System::String&) | Changes the user password and owner password by owner password, keeps the original security settings. The new user password and the new owner password can be null or empty. The owner password will be replaced Does not throw an exception if process failed. with a random string if the new owner password is null or empty. |
| TryChangePassword(const System::String&, const System::String&, const System::String&, const System::SharedPtr<DocumentPrivilege>&, KeySize) | Changes the user password and password by owner password, allows to reset Pdf documnent security. The new user password and the new owner password can be null or empty. The owner password will be replaced with a random string if the new owner password is null or empty. Does not throw an exception if process failed. |
| TryChangePassword(const System::String&, const System::String&, const System::String&, const System::SharedPtr<DocumentPrivilege>&, KeySize, Algorithm) | Changes the user password and password by owner password, allows to reset Pdf documnent security. The new user password and the new owner password can be null or empty. The owner password will be replaced with a random string if the new 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. Does not throw an exception if process failed. |
| TryDecryptFile(const System::String&) | Decrypts an encrypted Pdf document by owner password. If the document hasn’t owner password, it is allow to use user password. Does not throw an exception if process failed. |
| TryEncryptFile(const System::String&, const System::String&, const System::SharedPtr<DocumentPrivilege>&, KeySize) | 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. Does not throw an exception if process failed. |
| TrySetPrivilege(const System::String&, const System::String&, const System::SharedPtr<DocumentPrivilege>&) | Sets Pdf file security with original password. Does not throw an exception if process failed. |
See Also
- Class SaveableFacade
- Namespace Aspose::Pdf::Facades
- Library Aspose.PDF for C++