Class ExcelEncryption
How and if the workbook is encrypted ExcelProtection ExcelSheetProtection
Inheritance
System.Object
ExcelEncryption
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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 |
---|---|
System.Boolean |
Password
The password used to encrypt the workbook.
Declaration
public string Password { get; set; }
Property Value
Type | Description |
---|---|
System.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 |
---|---|---|
System.IO.Stream | stream | The stream containing the encrypted package. |
System.String | password | The password to decrypt with |
Returns
Type | Description |
---|---|
System.IO.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 |
---|---|---|
System.IO.Stream | stream | The stream containing the non-encrypted package. |
System.String | password | The password to encrypt with |
EncryptionVersion | encryptionVersion | The encryption version |
EncryptionAlgorithm | algorithm | The algorithm to use for the encryption |
Returns
Type | Description |
---|---|
System.IO.MemoryStream | A MemoryStream containing the encypted package |