Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

methodTstCustomCipherComponent.DecryptToDst

procedure DecryptToDst(const aBuf; aBufLen: Integer);
Decrypts aBufLen octets at aBuf and writes the (possibly differently- sized, due to padding) plaintext to DestinationStream; use this "ToDst" family instead of the in-place Decrypt/DecryptPtr when the cipher's mode/MAC/padding means the output cannot be the same size as the input (that is exactly what CanDecryptInplace / CanEncryptInplace check for). An application streams multiple calls before finishing with DoneToDst, and may split the ciphertext across them any way it likes, including calls of 0 octets and calls shorter than the tag: the last octets received (the cipher-MAC tag, or the padded last block) are held back until DoneToDst verifies them, and only plaintext is written. Raises eSecComp (S_ERR_DecryptionFailed) when the cipher declines the ciphertext, e.g. in CCM beyond the MessageLength set. No client/server- specific meaning; either peer decrypts data it received this way.