Class ExcelEncryption
How and if the workbook is encrypted ExcelProtection ExcelSheetProtection
Inherited Members
Namespace: OfficeOpenXml
Assembly: EPPlus.dll
Syntax
public class ExcelEncryption
Properties
Algorithm
Algorithm used for encrypting the package. Default is AES 128-bit for standard and AES 256 for agile
Declaration
public EncryptionAlgorithm Algorithm { get; set; }
Property Value
| Type | Description |
|---|---|
| EncryptionAlgorithm |
IsEncrypted
Is the package encrypted
Declaration
public bool IsEncrypted { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Password
The password used to encrypt the workbook.
Declaration
public string Password { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Version
The version of the encryption.
Declaration
public EncryptionVersion Version { get; set; }
Property Value
| Type | Description |
|---|---|
| EncryptionVersion |
Methods
DecryptPackage(Stream, string)
Decrypts a stream using the office encryption.
Declaration
public static MemoryStream DecryptPackage(Stream stream, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream containing the encrypted package. |
| string | password | The password to decrypt with |
Returns
| Type | Description |
|---|---|
| MemoryStream | A memorystream with the encypted package |
EncryptPackage(Stream, string, EncryptionVersion, EncryptionAlgorithm)
Encrypts a stream using the office encryption.
Declaration
public static MemoryStream EncryptPackage(Stream stream, string password, EncryptionVersion encryptionVersion = EncryptionVersion.Agile, EncryptionAlgorithm algorithm = EncryptionAlgorithm.AES256)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream containing the non-encrypted package. |
| string | password | The password to encrypt with |
| EncryptionVersion | encryptionVersion | The encryption version |
| EncryptionAlgorithm | algorithm | The algorithm to use for the encryption |
Returns
| Type | Description |
|---|---|
| MemoryStream | A MemoryStream containing the encypted package |