Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

methodTstCustomCipherComponent.Encrypt

procedure Encrypt(var aBuf; aBufLen: Integer);
In-place encryption: overwrites aBuf with the ciphertext for a mode without padding/MAC expansion (CanEncryptInplace must be true); see Decrypt for the corresponding constraints, including the whole number of blocks that ECB, CBC and ABC require (S_ERR_NotWholeBlocks): a shorter last block is refused, not left as plaintext. When the cipher cannot encrypt aBuf in place it raises eSecComp (S_ERR_EncryptionFailed) and leaves aBuf as it was, still the plaintext, which it does not pass to MAC either; every further in-place call then raises S_ERR_NoIV until a new IVector is set, or in cmCCM, cmEAX and cmGCM S_ERR_NoNonce until N and Initialize start the next message (see Decrypt). That happens, for example, in the SSH transport modes (cmSSH, cmSSHCTR), with a 3DES or RC2 cmKeyWrap cipher, when a padded block cipher was finished by EncryptStr or DecryptStr and not given a new IVector, and in CCM beyond the MessageLength set. An application prefers this over EncryptToDst when no size change and no separate output buffer are needed. No client/server-specific meaning.