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
packageEncryptedOfficePackageThe opened encrypted package.
passwordstringThe password, or null if none was supplied.
limitsResourceLimitsThe resource caps, or null for the defaults.
verifyIntegrityboolWhether 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
packageis 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.