• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class DocumentProtection

Provides access to document protection settings.

Inheritance
object
DocumentProtection
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Document
Assembly: DRIT.Document.dll
Syntax
public class DocumentProtection

Properties

AlgorithmName

The hash algorithm name (e.g. "SHA-512"), or null.

Declaration
public string AlgorithmName { get; set; }
Property Value
Type Description
string

HasPassword

Gets a value indicating whether a password hash is configured.

Declaration
public bool HasPassword { get; }
Property Value
Type Description
bool

HashValue

The password hash (base64), or null if no password is set.

Declaration
public string HashValue { get; set; }
Property Value
Type Description
string

IsEnforced

Whether protection is currently enforced.

Declaration
public bool IsEnforced { get; set; }
Property Value
Type Description
bool

ProtectionType

The type of editing restriction currently enforced, or NoProtection.

Declaration
public DocumentProtectionType ProtectionType { get; set; }
Property Value
Type Description
DocumentProtectionType

SaltValue

The salt value (base64), or null if no salt is used.

Declaration
public string SaltValue { get; set; }
Property Value
Type Description
string

SpinCount

The spin count for the hash, or 0 if not set.

Declaration
public int SpinCount { get; set; }
Property Value
Type Description
int

Methods

CanUnprotect(string)

Determines whether the specified password can remove the current protection. Documents without a password return true.

Declaration
public bool CanUnprotect(string password)
Parameters
Type Name Description
string password

The password to validate.

Returns
Type Description
bool

true if the password matches or no password is configured.

StartEnforcingProtection(DocumentProtectionType, string)

Starts enforcing document protection with the specified restriction type and password.

Declaration
public void StartEnforcingProtection(DocumentProtectionType ProtectionType, string password = null)
Parameters
Type Name Description
DocumentProtectionType ProtectionType

The type of editing restriction to enforce.

string password

The password to enforce protection, or null for no password.

StopEnforcingProtection()

Stops enforcing document protection when no password is configured.

Declaration
public void StopEnforcingProtection()
Exceptions
Type Condition
UnauthorizedAccessException

A password is configured and was not supplied.

StopEnforcingProtection(string)

Stops enforcing document protection after validating the password, when one is configured.

Declaration
public void StopEnforcingProtection(string password)
Parameters
Type Name Description
string password

The password used when protection was enabled.

Exceptions
Type Condition
UnauthorizedAccessException

The password is incorrect.

Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX