Method VerifyDocumentProtection
- Namespace
- DocWright.Cryptography
- Assembly
- DocWright.Cryptography.dll
VerifyDocumentProtection(DocumentProtection, string, ResourceLimits?)
Checks a password against the document-protection hash a document records.
public static bool VerifyDocumentProtection(DocumentProtection protection, string password, ResourceLimits? limits = null)
Parameters
protectionDocumentProtectionThe protection settings.
passwordstringThe password to check.
limitsResourceLimitsThe resource caps, or null for the defaults.
Returns
- bool
true when the password matches. false when it does not, and when the document records no hash to check it against — a document with no recorded password is not one that every password opens.
Remarks
In the Office 2007 spelling (w:hash) Word records a hash of the password's legacy key
(ComputeOffice2007(string, OfficeHashAlgorithmKind, byte[], int, ResourceLimits?)) and, checking one, also takes a hash of the password itself; both are
taken here, Word's own first.
Exceptions
- ArgumentNullException
An argument is null.