PdfFileSecurity Class
Represents encrypting or decrypting a Pdf file with owner or user password, changing the security setting and password.
Inheritance Hierarchy

Namespace: Aspose.Pdf.Facades
Assembly: Aspose.PDF (in Aspose.PDF.dll) Version: 19.12
Syntax
public sealed class PdfFileSecurity : SaveableFacade, 
	IDisposable

The PdfFileSecurity type exposes the following members.

Constructors
  NameDescription
Public methodPdfFileSecurity
Initialize the object of PdfFileSecurity.
Public methodPdfFileSecurity(Document)
Initializes new PdfFileSecurity object on base of the document.
Public methodPdfFileSecurity(Stream, Stream) Obsolete.
Initialize the object of PdfFileSecurity with input and output stream.
Public methodPdfFileSecurity(String, String) Obsolete.
Initializes the object of PdfFileSecurity with input and output file.
Public methodPdfFileSecurity(Document, Stream) Obsolete.
Initializes new PdfFileSecurity object on base of the document.
Public methodPdfFileSecurity(Document, String) Obsolete.
Initializes new PdfFileSecurity object on base of the document.
Properties
  NameDescription
Public propertyDocument
Gets the document facade is working on.
(Inherited from Facade.)
Public propertyInputFile Obsolete.
Sets the input file.
Public propertyInputStream Obsolete.
Sets the input stream.
Public propertyOutputFile Obsolete.
Sets the output file.
Public propertyOutputStream Obsolete.
Sets the output stream.
Methods
  NameDescription
Public methodBindPdf(Stream)
Initializes the facade.
(Overrides FacadeBindPdf(Stream).)
Public methodBindPdf(String)
Initializes the facade.
(Overrides FacadeBindPdf(String).)
Public methodBindPdf(Document)
Initializes the facade.
(Inherited from Facade.)
Public methodCode exampleChangePassword(String, String, 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.
Public methodCode exampleChangePassword(String, String, String, 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.
Public methodCode exampleChangePassword(String, String, String, 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.
Public methodClose
Closes the facade.
(Overrides FacadeClose.)
Public methodCode exampleDecryptFile
Decrypts an encrypted Pdf document by owner password. If the document hasn't owner password, it is allow to use user password.
Public methodDispose
Disposes the facade.
(Inherited from Facade.)
Public methodCode exampleEncryptFile(String, String, 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.
Public methodCode exampleEncryptFile(String, String, 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.
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodSave(Stream)
Saves the PDF document to the specified stream.
(Inherited from SaveableFacade.)
Public methodSave(String)
Saves the PDF document to the specified file.
(Inherited from SaveableFacade.)
Public methodCode exampleSetPrivilege(DocumentPrivilege)
Sets Pdf file security with empty user/owner passwords. The owner password will be added by a random string.
Public methodCode exampleSetPrivilege(String, String, DocumentPrivilege)
Sets Pdf file security with original password.
Public methodToString (Inherited from Object.)
See Also