Exceptions

This section documents the custom exceptions raised by the Fast File Encryption library.

These exceptions are designed to help you detect and handle issues related to data integrity and size limits during encryption and decryption operations.

class fast_file_encryption.IntegrityError

Raised when an encrypted file fails integrity validation.

This exception may occur in the following cases:

  • Invalid or missing file magic (not recognized as a valid .ffe file)

  • File is unexpectedly short or truncated

  • Checksum mismatch during validation

  • Corrupt or malformed data segments

  • Unsupported or unknown version markers

Use this exception to alert users or stop processing when a file cannot be trusted.

class fast_file_encryption.DataTooLargeError

Raised when the decrypted or encrypted data exceeds a specified maximum size limit.

This is commonly triggered if:

  • You set a maximum_size limit and the decrypted data would go beyond it

  • The file size exceeds the maximum allowed for encryption (e.g. 10 TB limit)

This exception helps safeguard systems against memory exhaustion or unintentional processing of oversized files.

Tools →