SpreadsheetControl.EncryptedFileIntegrityCheckFailed Event
Occurs when the encrypted file does not pass data integrity verification.
Namespace: DevExpress.XtraSpreadsheet
Assembly: DevExpress.XtraSpreadsheet.v24.1.dll
NuGet Package: DevExpress.Win.Spreadsheet
Declaration
public event EncryptedFileIntegrityCheckFailedEventHandler EncryptedFileIntegrityCheckFailed
Event Data
The EncryptedFileIntegrityCheckFailed event's data class is EncryptedFileIntegrityCheckFailedEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel | Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs. |
Remarks
SpreadsheetControl uses the Hash-based message authentication code (HMAC) to verify the document data integrity. If the document did not pass the code verification, the EncryptedFileIntegrityCheckFailed event is raised and the following message window is shown.
Note
The HMAC is calculated only for certain encryption types. When you save a password encrypted workbook, set the EncryptionOptions.Type to the EncryptionType.Strong to calculate HMAC.
Example
This code snippet handles the SpreadsheetControl.EncryptedFileIntegrityCheckFailed
event to perform certain actions when loading a corrupted password encrypted file.
private void SpreadsheetControl1_EncryptedFileIntegrityCheckFailed(object sender, EncryptedFileIntegrityCheckFailedEventArgs e) {
e.Cancel = true;
e.Handled = true;
MessageBox.Show("File is corrupted. Cannot load.","Warning");
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the EncryptedFileIntegrityCheckFailed event.
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.