TROEnvelopeMessageEncryption
Overview
The TROEnvelopeMessageEncryption class defines the procedures for encrypting and decrypting incoming and outgoing messages (from the server to the client or from the client to the server). The TROEnvelopeMessageEncryption is a descendant of the TROCustomEncryption class, so it contains complete information about the encryption method: the encryption method itself, the encryption send key, the encryption receive key as well as information about the usage or non-usage of compression with encrypted messages. The TROEnvelopeMessageEncryption is used in the TROEncryptionEnvelope visual component. For more information about encryption and envelopes, please refer to the See Also
section of this article.
Location
- Unit: uROEncryptionEnvelope.pas
- Ancestry: TPersistent | TROCustomEncryption | TROEnvelopeMessageEncryption
constructor Create (declared in TROCustomEncryption)
Creates a new instance.
constructor Create
AssignTo protected override (declared in TROCustomEncryption)
Copies the properties of an object to a destination object.
procedure AssignTo(Dest: TPersistent)
Parameters:
- Dest: destination object.
Decrypt override
Decrypts source stream
procedure Decrypt(Source: TStream; Dest: TStream)
Parameters:
- Source: Source
- Dest: Destination
Enclose protected (declared in TROCustomEncryption)
procedure Enclose(const iSourceStream: TStream; const iDestStream: TStream; iEncMethod: TROEncryptionMethod; isCompressed: Boolean; iKey: AnsiString)
Parameters:
- iSourceStream:
- iDestStream:
- iEncMethod:
- isCompressed:
- iKey:
Encrypt override
Encrypts the iPlainText original message to the iCiphertext cipher message. The method calls the Enclose procedure of the TROCustomEncryption class, which encrypts the original message with the specified EncryptionMethod, the EncryptionSendKey and UseCompression, which defines if the encrypted messages will be compressed (the EncryptionMethod, EncryptionSendKey and UseCompression are properties of the TROCustomEncryption class). This procedure is virtual, so you can override it in descendant classes to use your own encryption method.
procedure Encrypt(Source: TStream; Dest: TStream)
Parameters:
- Source: Original message
- Dest: Cipher message
EncryptionMethod (declared in TROCustomEncryption)
Specifies the encryption method to be used (default is tetNone, no encryption).
property EncryptionMethod: TROEncryptionMethod read write
EncryptionRecvKey (declared in TROCustomEncryption)
Specifies the key to be used for decrypting incoming messages.
property EncryptionRecvKey: TROCryptoKey read write
EncryptionSendKey (declared in TROCustomEncryption)
Specifies the key to be used for encrypting outgoing messages.
property EncryptionSendKey: TROCryptoKey read write
Extract protected (declared in TROCustomEncryption)
function Extract(const iSourceStream: TStream; const iDestStream: TStream; iKey: AnsiString): Int64
Parameters:
- iSourceStream:
- iDestStream:
- iKey:
isStreamEncrypted (declared in TROCustomEncryption)
Encrypts given stream
class function isStreamEncrypted(Source: TStream): Boolean
Parameters:
- Source: Stream
OnAfterDecryption (declared in TROCustomEncryption)
Fires after the decryption task has finished, giving you access to both the original (encrypted) and processed (decrypted) stream.
property OnAfterDecryption: TROEncryptionEvent read write
delegate: procedure OnAfterDecryption(Sender: TObject; OriginalStream: TStream; var ProcessedStream: TStream)
OnBeforeEncryption (declared in TROCustomEncryption)
Fires before the encryption task starts.
property OnBeforeEncryption: TROEncryptionEvent read write
delegate: procedure OnBeforeEncryption(Sender: TObject; OriginalStream: TStream; var ProcessedStream: TStream)
UseCompression (declared in TROCustomEncryption)
Toggles whether outgoing messages will be automatically compressed if they exceed a specific size. Compression will only apply if the EncryptionMethod is set to a value other then tetNone.
property UseCompression: Boolean read write
EncryptionMethod (declared in TROCustomEncryption)
Specifies the encryption method to be used (default is tetNone, no encryption).
property EncryptionMethod: TROEncryptionMethod read write
EncryptionRecvKey (declared in TROCustomEncryption)
Specifies the key to be used for decrypting incoming messages.
property EncryptionRecvKey: TROCryptoKey read write
EncryptionSendKey (declared in TROCustomEncryption)
Specifies the key to be used for encrypting outgoing messages.
property EncryptionSendKey: TROCryptoKey read write
UseCompression (declared in TROCustomEncryption)
Toggles whether outgoing messages will be automatically compressed if they exceed a specific size. Compression will only apply if the EncryptionMethod is set to a value other then tetNone.
property UseCompression: Boolean read write
isStreamEncrypted (declared in TROCustomEncryption)
Encrypts given stream
class function isStreamEncrypted(Source: TStream): Boolean
Parameters:
- Source: Stream
constructor Create (declared in TROCustomEncryption)
Creates a new instance.
constructor Create
AssignTo protected override (declared in TROCustomEncryption)
Copies the properties of an object to a destination object.
procedure AssignTo(Dest: TPersistent)
Parameters:
- Dest: destination object.
Decrypt override
Decrypts source stream
procedure Decrypt(Source: TStream; Dest: TStream)
Parameters:
- Source: Source
- Dest: Destination
Enclose protected (declared in TROCustomEncryption)
procedure Enclose(const iSourceStream: TStream; const iDestStream: TStream; iEncMethod: TROEncryptionMethod; isCompressed: Boolean; iKey: AnsiString)
Parameters:
- iSourceStream:
- iDestStream:
- iEncMethod:
- isCompressed:
- iKey:
Encrypt override
Encrypts the iPlainText original message to the iCiphertext cipher message. The method calls the Enclose procedure of the TROCustomEncryption class, which encrypts the original message with the specified EncryptionMethod, the EncryptionSendKey and UseCompression, which defines if the encrypted messages will be compressed (the EncryptionMethod, EncryptionSendKey and UseCompression are properties of the TROCustomEncryption class). This procedure is virtual, so you can override it in descendant classes to use your own encryption method.
procedure Encrypt(Source: TStream; Dest: TStream)
Parameters:
- Source: Original message
- Dest: Cipher message
Extract protected (declared in TROCustomEncryption)
function Extract(const iSourceStream: TStream; const iDestStream: TStream; iKey: AnsiString): Int64
Parameters:
- iSourceStream:
- iDestStream:
- iKey:
OnAfterDecryption (declared in TROCustomEncryption)
Fires after the decryption task has finished, giving you access to both the original (encrypted) and processed (decrypted) stream.
property OnAfterDecryption: TROEncryptionEvent read write
delegate: procedure OnAfterDecryption(Sender: TObject; OriginalStream: TStream; var ProcessedStream: TStream)
OnBeforeEncryption (declared in TROCustomEncryption)
Fires before the encryption task starts.
property OnBeforeEncryption: TROEncryptionEvent read write
delegate: procedure OnBeforeEncryption(Sender: TObject; OriginalStream: TStream; var ProcessedStream: TStream)