Back to Devexpress

DocumentEncryption.Type Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-documentencryption.md

latest3.8 KB
Original Source

DocumentEncryption.Type Property

Specifies the encryption type for the current document.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
EncryptionType Type { get; set; }
vb
Property Type As EncryptionType

Property Value

TypeDescription
EncryptionType

One of the EncryptionType enumeration values indicating the encryption type.

|

Available values:

NameDescription
Compatible

Standard encryption for Open XML files that uses a binary EncryptionInfo structure. The default encryption algorithm is AES-128 and SHA-1 is used as a hashing algorithm. Binary files (DOC) are encrypted by 40-bit RC4 encryption.

| | Strong |

Agile encryption for Open XML files that uses an XML EncryptionInfo structure. The default encryption algorithm is AES-256 and SHA512 is used as a hashing algorithm. Binary files (DOC) are encrypted by RC4 CryptoAPI encryption.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the Type property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-document-encryption/CS/RichEditControl_Encryption/Form1.cs#L95

csharp
richEditControl1.Document.Encryption.Password = passwordEdit1.EditValue.ToString();
richEditControl1.Document.Encryption.Type = (EncryptionType)Enum.Parse(typeof(EncryptionType), encryptionComboBox1.EditValue.ToString());
richEditControl1.SaveDocumentAs();

wpf-richedit-document-encryption/CS/DXRichEdit_Encryption/MainWindow.xaml.cs#L71

csharp
{
    richEditControl1.Document.Encryption.Type = (EncryptionType)Enum.Parse(typeof(EncryptionType), encryptionComboBoxEdit.Text);
}

winforms-richedit-document-encryption/VB/RichEditControl_Encryption/Form1.vb#L78

vb
richEditControl1.Document.Encryption.Password = passwordEdit1.EditValue.ToString()
richEditControl1.Document.Encryption.Type = CType([Enum].Parse(GetType(EncryptionType), encryptionComboBox1.EditValue.ToString()), EncryptionType)
richEditControl1.SaveDocumentAs()

See Also

DocumentEncryption Interface

DocumentEncryption Members

DevExpress.XtraRichEdit.API.Native Namespace