Encryption under a random initial value #
A random-IV mode draws a uniform n-bit initial value iv and outputs iv followed by a body
computed from the key, iv and the message. ivModeEncrypt body is this envelope for a body
body n k iv msg; it is efficient whenever the body is computable in polynomial time
(isPPTOn_ivModeEncrypt).
Randomized counter mode ([BS23], Section 5.4.2) and output feedback mode
(Exercise 5.15(b)) are the stream case: derive a keystream of whole n-bit blocks from the key
and iv, and XOR it with the message. They differ only in the keystream. ivStreamEncrypt keystream and ivStreamDecrypt keystream are this construction for a keystream generator
keystream n k iv blocks; ivStreamEncrypt keystream is defined as ivModeEncrypt with the XOR
body.
Decryption accepts an n-bit initial value followed by whole blocks.
Decryption inverts encryption on whole-block messages whenever the keystream has blocks * n bits
(ivStreamDecrypt_ivStreamEncrypt). Both algorithms are efficient whenever the keystream generator
is computable in polynomial time (isPPTOn_ivStreamEncrypt,
computableInPolyTime_ivStreamDecrypt).
Main definitions #
Cslib.Crypto.ivModeEncrypt,Cslib.Crypto.ivModeDecrypt: encryption and decryption envelopes under ann-bit initial value.Cslib.Crypto.ivStreamEncrypt,Cslib.Crypto.ivStreamDecrypt: stream encryption and decryption.
Main results #
Cslib.Crypto.ivModeDecrypt_ivModeEncrypt,Cslib.Crypto.ivStreamDecrypt_ivStreamEncrypt: correctness.Cslib.Crypto.isPPTOn_ivModeEncrypt,Cslib.Crypto.computableInPolyTime_ivModeDecrypt,Cslib.Crypto.isPPTOn_ivStreamEncrypt,Cslib.Crypto.computableInPolyTime_ivStreamDecrypt: efficiency.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Section 5.4.2 (printed p. 189) and Exercise 5.15 (printed p. 212).
Decryption envelope for an n-bit initial value with body decryptor decBody: accept a
ciphertext of at least n bits whose body length is a multiple of n, and run decBody on
(n, k, ct.take n, ct.drop n).
ivModeDecrypt inverts ivModeEncrypt on whole-block messages whenever encBody preserves
message length and decBody left-inverts encBody on every n-bit initial value.
Decryption inverts encryption on whole-block messages when the keystream from every n-bit
initial value has blocks * n bits.
Decryption under an initial value is computable in polynomial time on (n, k, ct) when the
body decryptor is computable in polynomial time on (n, k, iv, body).
Encryption under a random initial value is uniformly strict PPT in (n, k, msg) when the body
is computable in polynomial time on (n, k, iv, msg).
Stream encryption is uniformly strict PPT in (n, k, msg) when the keystream generator is
computable in polynomial time on (n, k, iv, blocks).
Stream decryption is computable in polynomial time on (n, k, ct) when the keystream
generator is computable in polynomial time on (n, k, iv, blocks).