Class DocumentProtectionHash
- Namespace
- DocWright.Cryptography
- Assembly
- DocWright.Cryptography.dll
Computes and checks the password hashes on w:documentProtection and
w:writeProtection.
These hashes are not a security boundary and DocWright does not treat them as one. Protection settings are a user-interface convenience: Word asks for the password before letting a person edit, and any program that ignores the setting edits anyway — including DocWright, which reports protection and never enforces it. What this class provides is the ability to answer "is this the password the document records?", and to record a new one.
public static class DocumentProtectionHash
- Inheritance
-
DocumentProtectionHash
- Inherited Members
Fields
- DefaultSaltSize
The salt length Word writes.
- DefaultSpinCount
The spin count Word writes. Used when a caller does not choose one.
Methods
- AlgorithmAttributeName(OfficeHashAlgorithmKind)
Returns the
w:algorithmNamespelling of an algorithm.
- AlgorithmFromSid(int?)
Maps a
w:cryptAlgorithmSidvalue onto an algorithm.
- Compute(string, OfficeHashAlgorithmKind, byte[], int, ResourceLimits?)
Computes a protection hash.
- SetDocumentProtectionPassword(DocumentProtection, string, ProtectionHashKind, OfficeHashAlgorithmKind, int, IRandomSource?)
Records a document-protection password on the settings, replacing any existing hash.
- SetWriteProtectionPassword(DocumentProtection, string, OfficeHashAlgorithmKind, int, IRandomSource?)
Records a write-protection password on the settings.
- SidFromAlgorithm(OfficeHashAlgorithmKind)
Maps an algorithm onto its
w:cryptAlgorithmSidvalue.
- VerifyDocumentProtection(DocumentProtection, string, ResourceLimits?)
Checks a password against the document-protection hash a document records.
- VerifyWriteProtection(DocumentProtection, string, ResourceLimits?)
Checks a password against the write-protection hash a document records.