Table of Contents

Method Decrypt

Namespace
DocWright.Cryptography
Assembly
DocWright.Cryptography.dll

Decrypt(EncryptedOfficePackage, string?, ResourceLimits?, bool)

Decrypts a package.

public static Stream Decrypt(EncryptedOfficePackage package, string? password, ResourceLimits? limits = null, bool verifyIntegrity = true)

Parameters

package EncryptedOfficePackage

The opened encrypted package.

password string

The password, or null if none was supplied.

limits ResourceLimits

The resource caps, or null for the defaults.

verifyIntegrity bool

Whether to run the HMAC integrity check when the descriptor carries one. Verifying re-reads the whole payload, so a caller streaming a very large document may skip it; the default is to check.

Returns

Stream

A seekable stream over the plaintext package, positioned at its start. The caller owns it and must dispose it.

Exceptions

ArgumentNullException

package is null.

DocumentEncryptedException

No password was supplied, or the scheme is unsupported.

InvalidPasswordException

The password did not verify.

DocumentIntegrityException

The payload failed its HMAC check.

ResourceLimitExceededException

The declared spin count exceeds the cap.