PdfPasswordEncryption Class
Stores encryption-related information for a PDF's standard security handler that shall allow up to two passwords to be specified for a document: a DocumentOpenPassword and a PermissionsPassword with access Permissions.
public sealed class PdfPasswordEncryption : PdfEncryption
Public NotInheritable Class PdfPasswordEncryption
Inherits PdfEncryption
- Inheritance:
- System.ObjectPdfPasswordEncryption
Properties
DocumentOpenPassword
Gets or sets the Document Open password (also known as a user password) required to open the PDF file.
Default value: System.String.Empty (PDF file can be decrypted without a password).
public string DocumentOpenPassword { get; set; }
Public Property DocumentOpenPassword As String
Property Value
- System.String
The Document Open password.
Exceptions
- System.InvalidOperationException
Current encryption information is used to read or write an encrypted PDF file and cannot be changed. Set new encryption information instead.
EncryptionLevel
Gets or sets the encryption level.
Default value: AES_128.
public PdfEncryptionLevel EncryptionLevel { get; set; }
Public Property EncryptionLevel As PdfEncryptionLevel
Property Value
The encryption level.
Exceptions
- System.InvalidOperationException
Current encryption information is used to read or write an encrypted PDF file and cannot be changed. Set new encryption information instead.
Options
Gets or sets the encryption options.
Default value: EncryptAll.
public PdfEncryptionOptions Options { get; set; }
Public Property Options As PdfEncryptionOptions
Property Value
The encryption options.
Exceptions
- System.InvalidOperationException
Current encryption information is used to read or write an encrypted PDF file and cannot be changed. Set new encryption information instead.
Permissions
(Required) A set of flags specifying which operations shall be permitted when the document is opened with user access (see Table 22).
public PdfUserAccessPermissions Permissions { get; set; }
Public Property Permissions As PdfUserAccessPermissions
Property Value
A set of flags specifying which operations shall be permitted when the document is opened with user access.
Exceptions
- System.InvalidOperationException
Current encryption information is used to read or write an encrypted PDF file and cannot be changed. Set new encryption information instead.
See Also
PermissionsPassword
Gets or sets the Permissions password (also known as a master password) required if a user performs an action that is not allowed by Permissions.
Default value: DocumentOpenPassword (actions not allowed by Permissions can be performed without a password).
public string PermissionsPassword { get; set; }
Public Property PermissionsPassword As String
Property Value
- System.String
The Permissions password.
Exceptions
- System.InvalidOperationException
Current encryption information is used to read or write an encrypted PDF file and cannot be changed. Set new encryption information instead.
Methods
CheckPassword(String, PdfDocument, out Boolean)
Determines whether the specified password
is correct password to decrypt the specified document
using this PdfPasswordEncryption.
public bool CheckPassword(string password, PdfDocument document, out bool isPermissionsPassword)
Public Function CheckPassword(password As String, document As PdfDocument, ByRef isPermissionsPassword As Boolean) As Boolean
Parameters
password
- System.String
The password to check for correctness.
document
- PdfDocument
The encrypted document for which to check the specified password
.
isPermissionsPassword
- System.Boolean
If set to true, the specified password
is a correct PermissionsPassword.
Returns
- System.Boolean
true if the specified password
is a correct password to decrypt the specified document
using this PdfPasswordEncryption; otherwise, false.
Exceptions
- System.ArgumentNullException
password
or document
is null.
Inherited Properties
Metadata | (Optional; PDF 1.4) A metadata stream containing metadata for the component. (Inherited from PdfObject) |