Table of Contents

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

protection DocumentProtection

The protection settings to update.

password string

The password to record.

kind ProtectionHashKind

Which attribute spelling to write.

algorithm OfficeHashAlgorithmKind

The hash algorithm.

spinCount int

The iteration count.

randomSource IRandomSource

The salt source, or null for the platform RNG.

Exceptions

ArgumentNullException

An argument is null.