Method SetDocumentProtectionPassword
- Namespace
- DocWright.Cryptography
- Assembly
- DocWright.Cryptography.dll
SetDocumentProtectionPassword(DocumentProtection, string, ProtectionHashKind, OfficeHashAlgorithmKind, int, IRandomSource?)
Records a document-protection password on the settings, replacing any existing hash.
public static void SetDocumentProtectionPassword(DocumentProtection protection, string password, ProtectionHashKind kind = ProtectionHashKind.IsoStrengthened, OfficeHashAlgorithmKind algorithm = OfficeHashAlgorithmKind.Sha512, int spinCount = 100000, IRandomSource? randomSource = null)
Parameters
protectionDocumentProtectionThe protection settings to update.
passwordstringThe password to record.
kindProtectionHashKindWhich attribute spelling to write.
algorithmOfficeHashAlgorithmKindThe hash algorithm.
spinCountintThe iteration count.
randomSourceIRandomSourceThe salt source, or null for the platform RNG.
Exceptions
- ArgumentNullException
An argument is null.