note 70947 added to function.mcrypt-create-iv
| From: | Chris at osu1 dot php dot net | Date: | Sun, 05 Nov 2006 23:07:09 +0000 |
| Subject: | note 70947 added to function.mcrypt-create-iv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119413@lists.php.net to get a copy of this message | ||
>First, the IV should be random and variable. The whole >point of it is to ensure that the
>same plaintext does not >encrypt to the same ciphertext every time. You most >certainly do
>lose security if the IV is constant or public.
Wrong, Wrong WRONG! The initialization vector is ALLOWED to be PUBLIC! It is generally sent along
with the ciphertext, UNENCRYPTED.
>The ciphertext should be E(IV | plaintext, key)
Wrong again! The initialization vector is NOT prepended to the plaintext before encryption. The IV
is used to seed the feedback system! (which is why you don't need one in ECB mode - there is no
feedback)
>Second, the IV should not be part of the decryption >parameters at all. You should be able to
>decrypt the cipher >text, throw away the initial vector at the front w/o even >reading it, and
>have your plaintext:
Nope. You need to seed the feedback mechanism during decryption to the SAME state as it was seeded
during encryption. This means using the SAME IV!
----
Server IP: 66.207.199.35
Probable Submitter: 64.180.161.38
----
Manual Page -- http://www.php.net/manual/en/function.mcrypt-create-iv.php
Edit -- https://master.php.net/note/edit/70947
Del: integrated -- https://master.php.net/note/delete/70947/integrated
Del: useless -- https://master.php.net/note/delete/70947/useless
Del: bad code -- https://master.php.net/note/delete/70947/bad+code
Del: spam -- https://master.php.net/note/delete/70947/spam
Del: non-english -- https://master.php.net/note/delete/70947/non-english
Del: in docs -- https://master.php.net/note/delete/70947/in+docs
Del: other reasons-- https://master.php.net/note/delete/70947
Reject -- https://master.php.net/note/reject/70947
Search -- https://master.php.net/manage/user-notes.php