[]
        
(Showing Draft Content)

GrapeCity.Documents.Pdf.Security.StandardSecurityHandler

Class StandardSecurityHandler

Namespace
GrapeCity.Documents.Pdf.Security
Assembly
GcDocs.Pdf.dll

Defines base class for Standard Security Handlers. These security handlers allow access permissions and up to two passwords to be specified for a document: an owner password and a user password.

public abstract class StandardSecurityHandler : SecurityHandlerBase, IPdfDict, IDisposable
Inheritance
object
StandardSecurityHandler
Implements
System.IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Extension Methods

Constructors

StandardSecurityHandler()

Initializes a new instance of the StandardSecurityHandler class.

public StandardSecurityHandler()

Properties

AccessType

Gets the access type granted by this StandardSecurityHandler, or null. This property is initialized when a document is loaded.

public AccessType? AccessType { get; }

Property Value

AccessType?

HasOwnerPassword

Gets a value indicating whether the PDF has an owner password that is required to edit the document.

This property is initialized when the document is loaded.

Note that a document may be encrypted with an empty password, in which case HasUserPassword and HasOwnerPassword properties return false.

Note also that, according to the PDF specification, if an owner password is not specified, then the user password should be used. GcPdf follows this rule, so if a PDF that was created using GcPdf with only a user password is loaded into GcPdfDocument, its AccessType will be Owner, HasOwnerPassword will be true and HasUserPassword will also be true.
[Obsolete("Use PasswordMatches instead.")]
public bool? HasOwnerPassword { get; }

Property Value

bool?

HasUserPassword

Gets a value indicating whether the PDF has a user password that is required to open the document.

This property is initialized when the document is loaded.

Note that a document may be encrypted with an empty password, in which case HasUserPassword and HasOwnerPassword properties return false.

Note also that, according to the PDF specification, if an owner password is not specified, then the user password should be used. GcPdf follows this rule, so if a PDF that was created using GcPdf with only a user password is loaded into GcPdfDocument, its AccessType will be Owner, HasOwnerPassword will be true and HasUserPassword will also be true.
[Obsolete("Use PasswordMatches instead.")]
public bool? HasUserPassword { get; }

Property Value

bool?

OwnerPassword

Gets or sets the password required to change permissions of a PDF document as a string.

The two properties OwnerPassword and OwnerPasswordBytes allow to define the password as a string or as an array of bytes.

According to the PDF specification, a string password should be converted to an array of bytes using the system code page (if the standard security handler with revision 4 or less is used). In some environments the system code page is unavailable, so GcPdf cannot perform this conversion. If the password string only contains ASCII chars, this does not present a problem. But if the password string contains non-ASCII Unicode characters, it is up to the developer to perform the conversion and set the password using this property.
public string OwnerPassword { get; set; }

Property Value

string

OwnerPasswordBytes

Gets or sets the password required to change permissions of a PDF document as a byte array.

The two properties OwnerPassword and OwnerPasswordBytes allow to define the password as a string or as an array of bytes.

According to the PDF specification, a string password should be converted to an array of bytes using the system code page (if the standard security handler with revision 4 or less is used). In some environments the system code page is unavailable, so GcPdf cannot perform this conversion. If the password string only contains ASCII chars, this does not present a problem. But if the password string contains non-ASCII Unicode characters, it is up to the developer to perform the conversion and set the password using this property.
public byte[] OwnerPasswordBytes { get; set; }

Property Value

byte[]

PasswordMatches

Gets a combination of flags that indicate how the password specified when loading the PDF matches the document's User and Owner passwords.

public PasswordMatches PasswordMatches { get; }

Property Value

PasswordMatches

Revision

Gets the revision of this StandardSecurityHandler.

public int Revision { get; }

Property Value

int

UserPassword

Gets or sets the password required to open a PDF document as a string.

The two properties UserPassword and UserPasswordBytes allow to define the password as a string or as an array of bytes.

According to the PDF specification, a string password should be converted to an array of bytes using the system code page (if the standard security handler with revision 4 or less is used). In some environments the system code page is unavailable, so GcPdf cannot perform this conversion. If the password string only contains ASCII chars, this does not present a problem. But if the password string contains non-ASCII Unicode characters, it is up to the developer to perform the conversion and set the password using UserPasswordBytes.
public string UserPassword { get; set; }

Property Value

string

UserPasswordBytes

Gets or sets the password required to open a PDF document as a byte array.

The two properties UserPassword and UserPasswordBytes allow to define the password as a string or as an array of bytes.

According to the PDF specification, a string password should be converted to an array of bytes using the system code page (if the standard security handler with revision 4 or less is used). In some environments the system code page is unavailable, so GcPdf cannot perform this conversion. If the password string only contains ASCII chars, this does not present a problem. But if the password string contains non-ASCII Unicode characters, it is up to the developer to perform the conversion and set the password using this property.
public byte[] UserPasswordBytes { get; set; }

Property Value

byte[]

Methods

AssignFrom(SecurityHandlerBase)

Copies all property values from another object.

public override void AssignFrom(SecurityHandlerBase source)

Parameters

source SecurityHandlerBase

The source object.

Dispose(bool)

Releases the unmanaged resources used by the SecurityHandlerBase and optionally releases the managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool