The IDEA unit provides IDEA encryption support

Besides some low level IDEA encryption routines, the IDEA unit also offers 2 streams which offer on-the-fly encryption or decryption: there are 2 stream objects: A write-only encryption stream which encrypts anything that is written to it, and a decription stream which decrypts anything that is read from it.

Used for exception support Used for TOwnerStream definition. IDEA Key size constant. IDEA block size Number of rounds to encrypt Key length Type for holding a user IDEA key The IDEA key should be filled by the user with some random data (say, a passphrase). This key is used to generate the actual encryption/decryption keys. Type for holding an encyption/decryption IDEA key. The actual encryption or decryption key for IDEA is 64-bit long. This type is used to hold such a key. It can be generated with the or algorithms depending on whether an encryption or decryption key is needed. Buffer type to hold encryption data. TIdeaCryptData is an internal type, defined to hold data for encryption/decryption. Alias for TIDEAKey Provided for backward functionality. Alias for for TIDEACryptKey Provided for backward functionality. Alias for for TIDEACryptData Provided for backward functionality. Create an IDEA encryption key from a user key. EnKeyIdea creates an IDEA encryption key from user-supplied data in UserKey. The Encryption key is stored in z. None. User-supplied data to generate key from 64-bit Encryption key. Create a decryption key from an encryption key. DeKeyIdea creates a decryption key based on the encryption key z. The decryption key is returned in dk. Note that only a decryption key generated from the encryption key that was used to encrypt the data can be used to decrypt the data. None. Encryption key Key for decryption Encrypt or decrypt a buffer. CipherIdea encrypts or decrypts a buffer with data (Input) using key z. The resulting encrypted or decrypted data is returned in Output. None. Data to be encrypted/decrypted Decrypted/Encrypted data Key to use for Encryption/Decryption Exception for IDEA Stream errors. EIDEAError is used to signal errors in the IDEA encryption decryption streams. Ancestor stream for IDEA encryption/decryption streams. Do not create instances of TIDEAStream directly. It implements no useful functionality: it serves as a common ancestor of the and , and simply provides some fields that these descendent classes use when encrypting/decrypting. One of these classes should be created, depending on whether one wishes to encrypt or to decrypt. Creates a new instance of the TIDEAStream class Create stores the encryption/decryption key and then calls the inherited Create to store the Dest stream. None. Key to use for encryption/decryption Stream to write encrypted data to/read encrypted data from Key used when encrypting/decrypting Key is the key as it was passed to the constructor of the stream. It cannot be changed while data is read or written. It is the key as it is used when encrypting/decrypting. IDEA encryption stream.

TIDEAEncryptStream is a stream which encrypts anything that is written to it using the IDEA mechanism, and then writes the encrypted data to the destination stream using the algorithm. It is a write-only stream: it is not possible to read data from this stream.

When creating a TIDEAEncryptStream instance, an IDEA encryption key should be passed to the constructor, as well as the stream to which encrypted data should be written.

The resulting encrypted data can be read again with a decryption stream.

Flush data buffers and free the stream instance.

Destroy flushes any data still remaining in the internal encryption buffer, and then calls the inherited Destroy

By default, the destination stream is not freed when the encryption stream is freed.

None.
Read data from the stream Read always raises an exception, because the encryption stream is write-only. To read from an encrypted stream, use the Read method of the decryption stream. An exception is raised when calling this method. Write Number of bytes read Buffer to store read data Number of bytes to read. Write bytes to the stream to be encrypted Write writes Count bytes from Buffer to the stream, encrypting the bytes as they are written (encryption in blocks of 8 bytes). If an error occurs writing to the destination stream, an error may occur. Read Number of bytes actually written. Buffer containing data to be written Number of bytes to write. Set stream position Seek return the current position if called with 0 and soFromCurrent as arguments. With all other values, it will always raise an exception, since it is impossible to set the position on an encryption stream. An will be raised unless called with 0 and soFromCurrent as arguments. Write New location after seek operation Number of bytes to move stream pointer Where to move stream pointer from Write remaining bytes from the stream Flush writes the current encryption buffer to the stream. Encryption always happens in blocks of 8 bytes, so if the buffer is not completely filled at the end of the writing operations, it must be flushed. It should never be called directly, unless at the end of all writing operations. It is called automatically when the stream is destroyed. None. Write IDEA Decryption stream.

TIDEADecryptStream is a stream which decrypts anything that is read from it using the IDEA mechanism. It reads the encrypted data from a source stream and decrypts it using the algorithm. It is a read-only stream: it is not possible to write data to this stream.

When creating a TIDEADecryptStream instance, an IDEA decryption key should be passed to the constructor, as well as the stream from which encrypted data should be read written.

The encrypted data can be created with a encryption stream.

Reads data from the stream, decrypting it as needed Read attempts to read Count bytes from the stream, placing them in Buffer the bytes are read from the source stream and decrypted as they are read. (bytes are read from the source stream in blocks of 8 bytes. The function returns the number of bytes actually read. If an error occurs when reading data from the source stream, an exception may be raised. Write Seek Number of bytes actually read. Buffer to place the descrypted data Number of bytes that should be read from the stream. Write data to the stream Write always raises an exception, because the decryption stream is read-only. To write to an encryption stream, use the Write method of the decryption stream. An exception is raised when calling this method. Read Number of written bytes Buffer containing data to be written Number of bytes to write Set position on the stream

Seek will only work on a forward seek. It emulates a forward seek by reading and discarding bytes from the input stream. The TIDEADecryptStream stream tries to provide seek capabilities for the following limited number of cases:

Origin=soFromBeginning
If Offset is larger than the current position, then the remaining bytes are skipped by reading them from the stream and discarding them.
Origin=soFromCurrent
If Offset is zero, the current position is returned. If it is positive, then Offset bytes are skipped by reading them from the stream and discarding them.
An exception is raised if the stream does not allow the requested seek operation. Read
New position in the stream Offset to apply to the position in the stream Origin from where Offset should be counted. Exception support Stream support and definitions Constructor to create a new TIDEAEncryptStream instance

Create creates a new TIDEAEncryptStream instance using the the string AKey to compute the encryption key, which is then passed on to the inherited constructor . It is an easy-access function which introduces no new functionality.

The string is truncated at the maximum length of the structure, so it makes no sense to provide a string with length longer than this structure.

String to use as key data. Destination stream for encrypted data Constructor to create a new TIDEADecryptStream instance

Create creates a new TIDEADecryptStream instance using the the string AKey to compute the encryption key, which is then passed on to the inherited constructor . It is an easy-access function which introduces no new functionality.

The string is truncated at the maximum length of the structure, so it makes no sense to provide a string with length longer than this structure.

String to use as the encryption key Source stream with encrypted data