Table of Contents

Class ExcelEncryption

Namespace
OfficeOpenXml
Assembly
EPPlus.dll

How and if the workbook is encrypted ExcelProtection ExcelSheetProtection

public class ExcelEncryption
Inheritance
ExcelEncryption
Inherited Members

Properties

Algorithm

Algorithm used for encrypting the package. Default is AES 128-bit for standard and AES 256 for agile

public EncryptionAlgorithm Algorithm { get; set; }

Property Value

EncryptionAlgorithm

IsEncrypted

Is the package encrypted

public bool IsEncrypted { get; set; }

Property Value

bool

Password

The password used to encrypt the workbook.

public string Password { get; set; }

Property Value

string

Version

The version of the encryption.

public EncryptionVersion Version { get; set; }

Property Value

EncryptionVersion

Methods

DecryptPackage(Stream, string)

Decrypts a stream using the office encryption.

public static MemoryStream DecryptPackage(Stream stream, string password)

Parameters

stream Stream

The stream containing the encrypted package.

password string

The password to decrypt with

Returns

MemoryStream

A memorystream with the encypted package

EncryptPackage(Stream, string, EncryptionVersion, EncryptionAlgorithm)

Encrypts a stream using the office encryption.

public static MemoryStream EncryptPackage(Stream stream, string password, EncryptionVersion encryptionVersion = EncryptionVersion.Agile, EncryptionAlgorithm algorithm = EncryptionAlgorithm.AES256)

Parameters

stream Stream

The stream containing the non-encrypted package.

password string

The password to encrypt with

encryptionVersion EncryptionVersion

The encryption version

algorithm EncryptionAlgorithm

The algorithm to use for the encryption

Returns

MemoryStream

A MemoryStream containing the encypted package