Table of Contents

Class XlsxEncryption

Namespace
DocWright.Spreadsheet.Security
Assembly
DocWright.Spreadsheet.Security.dll

A password-encrypted workbook opened, and a workbook saved encrypted (Phase 215), as Excel does: an Office compound file whose EncryptedPackage stream holds the workbook. Excel writes ECMA-376 agile encryption (AES-256, SHA-512, 100,000 spins); agile and standard encryption are read. The encryption is DocWright.Cryptography's, the code a Word document's encryption uses.

public static class XlsxEncryption
Inheritance
XlsxEncryption
Inherited Members

Remarks

Encryption is security, unlike a sheet's or a workbook's protection (a flag for Excel's interface). The password is used to derive the key and is not kept; the key derivation is bounded by MaxKeyDerivationSpinCount. A save draws a new random salt and key each time, so two saves of one workbook differ; a caller that needs the same bytes (a test) supplies RandomSource.

Methods

IsEncrypted(Stream)

Gets whether a stream holds an encrypted Office package (and not a plain workbook).

Open(Stream, string?, XlsxReadSettings?)

Opens a workbook that may be encrypted: an encrypted one with its password, a plain one as Open(Stream, XlsxReadSettings?) opens it (the password is then not used).

Save(XlsxDocument, Stream, AgileEncryptionSettings, XlsxWriteSettings?)

Saves a workbook encrypted with a password, as Excel's Encrypt with Password does: agile encryption with the settings' key size, hash and spin count (Excel's own by default: AES-256, SHA-512, 100,000 spins).