Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

methodTstCustomCipherComponent.Decrypt

procedure Decrypt(var aBuf; aBufLen: Integer);
In-place decryption: overwrites aBuf with the plaintext for a mode without padding/MAC expansion (CanDecryptInplace must be true, e.g. stream ciphers or unpadded block modes); raises (via CheckKeyNotSet) if a destination stream is assigned or a pending IV requirement is outstanding. In ECB, CBC and ABC, aBufLen must be a whole number of blocks (BlockSize octets); any other length raises eSecComp (S_ERR_NotWholeBlocks) before aBuf, MAC or the cipher is touched, and the next call goes ahead as though this one had not been made. When the cipher cannot decrypt aBuf in place it raises eSecComp (S_ERR_DecryptionFailed) and leaves aBuf as it was, still the ciphertext; every further in-place call then raises S_ERR_NoIV until a new IVector is set - in cmCCM, cmEAX and cmGCM the message is ended instead, and every further call raises S_ERR_NoNonce until N and Initialize start the next (see Mode on TstCipher). 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 DecryptToDst when no size change and no separate output buffer are needed; it is not the right call when a MAC/AEAD tail needs verifying (CanDecryptInplace already excludes that case), for which DecryptToDst/DoneToDst should be used instead. No client/server-specific meaning.