Breaking Change T973019
Visible to All Users

RC4 CryptoAPI is now the default encryption method for binary files (DOC and XLS)

What Changed

If you use the EncryptionType.Strong encryption type to encrypt a binary file (DOC or XLS), the document will be encrypted by using our custom RC4 CryptoAPI encryption implementation. In previous versions, Office binary document RC4 encryption was used.

Reasons for Change

RC4 CryptoAPI encryption is used as the default encryption method for binary files in Microsoft Office 2013 and higher. It is considered to be more secure than 40-bit RC4 encryption.

How to Revert to Previous Behavior

Select the EncryptionType.Compatible encryption type if you wish to use the RC4 encryption algorithm to encrypt your DOC / XLS document.

Example 1. Encrypt an XLS file

C#
// Specify encryption settings. EncryptionSettings encryptionSettings = new EncryptionSettings(); // Use RC4 encryption. encryptionSettings.Type = DevExpress.Spreadsheet.EncryptionType.Compatible; encryptionSettings.Password = "password"; // Save workbook. workbook.SaveDocument("Document.xls", DocumentFormat.Xls, encryptionSettings);
Visual Basic
' Specify encryption settings. Dim encryptionSettings As New EncryptionSettings() ' Use RC4 encryption. encryptionSettings.Type = DevExpress.Spreadsheet.EncryptionType.Compatible encryptionSettings.Password = "password" ' Save workbook. workbook.SaveDocument("Document.xls", DocumentFormat.Xls, encryptionSettings)

Example 2. Encrypt a DOC file

C#
// Specify encryption settings. EncryptionSettings encryptionSettings = new EncryptionSettings(); // Use RC4 encryption. encryptionSettings.Type = DevExpress.XtraRichEdit.API.Native.EncryptionType.Compatible; encryptionSettings.Password = "password"; // Save document. document.SaveDocument("Document.doc", DocumentFormat.Doc, encryptionSettings);
Visual Basic
' Specify encryption settings. Dim encryptionSettings As New EncryptionSettings() ' Use RC4 encryption. encryptionSettings.Type = DevExpress.XtraRichEdit.API.Native.EncryptionType.Compatible encryptionSettings.Password = "password" ' Save document. document.SaveDocument("Document.doc", DocumentFormat.Doc, encryptionSettings)

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.