PicoMite V6.00.01 release candidates - please test thoroughly


Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3054
Posted: 11:30pm 22 Dec 2024      

  matherp said  For CBC and CTR decryption the firmware assumes that the first 16 bytes of in%() are the initialisation vector.

My understanding is an IV is always prepended to the message. If you don't specify one a random one is used.
If you supply an IV at the decryption end the prepended one is ignored.

Edit.
Perhaps I haven't understood the question.
  Quote  For CBC and CTR modes the encryption will generate a random initialisation vector and prepend out%() with the IV. If an explicit IV is specified this will be used instead of the random vector and this will be prepended to out%()
For CBC and CTR decryption the firmware assumes that the first 16 bytes of in%() are the initialisation vector.
In the case where you want to transmit a message without IV you can use LONGSTRING RIGHT to remove the IV before sending the message. In this case the recipient must know the IV as well as the key and create a complete longstring before using DECRYPT. This can be done by using LONGSTRING CONCAT to add the incoming message to a longstring containing the IV.


If the IV has been removed before sending it is up to the receiving end program to add the IV before decrypting. There is no automatic mechanism to determine if the IV has been removed before sending.
Edited 2024-12-23 09:44 by phil99