HotXLS Docs

IXLSWorkBook.EncryptionType property

Unit: lxHandle
Encryption flavor applied when the workbook is saved with a password

Syntax

property EncryptionType: TXLSEncryptionType read GetEncryptionType write SetEncryptionType

Description

Controls the encryption scheme selected when a password is set via EncryptionPassword. xletAuto (the default) picks RC4 CryptoAPI for BIFF8 and XOR obfuscation for BIFF5. xletXor forces BIFF5 XOR obfuscation only, while xletRC4 forces BIFF8 RC4 standard encryption. When a non-empty password is set and the format is BIFF8, saving emits a FILEPASS record after the workbook BOF and RC4-encrypts the Workbook stream

RC4 CryptoAPI output uses a 128-bit key and names the compatible Microsoft Enhanced Cryptographic Provider in the standard header. Summary and document-summary properties are written as ordinary plaintext OLE property streams; the encryption header sets fDocProps to describe that choice correctly. A workbook password protects workbook data and does not encrypt those document properties

Classic RC4 and RC4 CryptoAPI load and save are available in the native Linux/macOS LX_PORTABLE_CORE profile as well as Windows. This property belongs to the Classic XLS facade; encrypted OOXML output has its separate platform contract

64-bit decrypter positions

Built-in Classic decrypters expose SetPosition64(Position: Int64) and keep physical position and RC4 block identity without a 32-bit cursor wrap

The existing virtual SetPosition(Position: LongWord) entry remains for source compatibility; built-in overrides delegate to the new entry

An existing external subclass inherits a default SetPosition64 implementation that delegates within unsigned 32-bit positions and refuses a larger offset unless the subclass overrides the new entry

All binary consumers must rebuild after the virtual table and object-layout change; position and processing APIs retain their successful password-initialization precondition

RC4 and CryptoAPI retain their unsigned 32-bit block-number domain with 1024-byte blocks, accepting the legal one-past-end cursor while rejecting any positive count beyond that domain before changing caller bytes

XOR retains its separate modulo-16 behavior and Int64 cursor checks; the RC4 block-number limit does not apply to XOR

Negative counts/positions, invalid buffer ranges and integer overflow refuse before byte transformation; ordinary encrypted records, plaintext prefixes, bypass semantics and separate Pivot-cache resets retain their existing behavior

See physical read positions and qualification boundaries for partial reads, caller prefixes and actual wire-field widths

Incremental record transformer

Normal Classic saving now encrypts generated record blobs in order with TXLSBiffStreamCipher from lxEncrypter, preserving existing RC4, CryptoAPI, XOR and FILEPASS behavior without a second whole-stream flattening allocation

Advanced callers use CreateRC4, CreateCryptoAPI or CreateXor with the existing bypass count and matching key material, call Process on valid buffer ranges in order, then call Finish after the complete record sequence

Process transforms only the supplied range in place and accepts splits inside record headers, bodies and cipher blocks; Finish rejects incomplete records after the bypass prefix, and input after completion is rejected

Negative ranges, nil nonempty buffers and inherited uninitialized construction refuse explicitly; a stream entirely contained in the declared bypass retains its bytes, and this transformer is not a general BIFF schema or security validator

Exceptions can leave earlier supplied chunks transformed, so direct callers retain their own staging and publication responsibility; the workbook caller uses temporary generated records and its existing staged-save boundary

Each independent Pivot cache needs its own transformer at position zero; generated record-list memory and password-dependent key derivation retain their existing costs

See incremental encryption and measured allocation scope for the bounded payload-copy contract

See also