HotXLS Docs

IXLSWorkBook.EncryptionType property

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

Syntax

property EncryptionType: TXLSEncryptionType read GetEncryptionType write SetEncryptionType

Description

Controls the encryption scheme chosen 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, whilst xletRC4 forces BIFF8 RC4 standard encryption. If 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, and the encryption header sets fDocProps to record that choice. A workbook password protects workbook data; those document properties are not encrypted

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

64-bit decrypter positions

Built-in Classic decrypters expose SetPosition64(Position: Int64) and hold on to physical position and RC4 block identity with no 32-bit cursor wrap

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

An existing external subclass picks up a default SetPosition64 implementation that delegates within unsigned 32-bit positions and turns away 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 keep 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 whilst refusing any positive count beyond that domain before touching caller bytes

XOR keeps its separate modulo-16 behaviour 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 any byte transformation; ordinary encrypted records, plaintext prefixes, bypass semantics and separate Pivot-cache resets keep their existing behaviour

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 the existing RC4, CryptoAPI, XOR and FILEPASS behaviour without a second whole-stream flattening allocation

Advanced callers reach for CreateRC4, CreateCryptoAPI or CreateXor with the existing bypass count and matching key material, call Process over valid buffer ranges in order, then call Finish once the record sequence is complete

Process transforms only the supplied range in place and accepts splits inside record headers, bodies and cipher blocks; Finish turns away 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 sitting entirely inside the declared bypass keeps its bytes, and this transformer is not a general BIFF schema or security validator

Exceptions can leave earlier supplied chunks transformed, so direct callers keep 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 keep their existing costs

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

See also