Re: [pac] Re: Using keys not generated by your module ...
[email protected] (Benjamin Trott) Sun, 08 Apr 2001 12:49:38 -0700
| Newsgroups | perl.crypto |
|---|---|
| Message-ID | <B6F60EE2.9304%[email protected]> |
> Actually, Crypt::CBC uses a static IV of "RandomIV" - a holdover from
> Eric Young's stuff. (to verify this, encrypt the same plaintext numerous
> times . . you'll find that the ciphertext never changes. [use
> encrypt_hex() just to make comparisons easy])
Hmm, I can't seem to duplicate this. From my reading of the Crypt::CBC code,
I thought that the "RandomIV" preceded the actual random IV, which is then
read from the ciphertext. For example, I tried this:
use Crypt::CBC;
my $cbc = Crypt::CBC->new('my key', 'Crypt::DES');
print $cbc->encrypt_hex("foo bar baz"), "\n" for 1..3;
And when I run it a couple of times:
52616e646f6d495689b6ddbbc84461429daf676628d05ce4edfa1c2e9391482c
52616e646f6d495631992c4bbf3ab656ac151d6204ddd53b0e6c2bf26f2175c6
52616e646f6d49569b8a3b86e5853c159fd366161cc9f6ec6b30471a1803b20d
^
|
---------------------
All ciphertexts start with the same string ("RandomIV"), but then after
those first 8 octets (where the arrow points) they're different.
Am I looking in the wrong place?
> I currently have two alternatives available to Crypt::CBC (the static IV
> bothers me terribly). The first is Crypt::CBC_R (random IV), which can
> read older Crypt::CBC messages, but not write them; the other is
> Crypt::CBC_IL, a 4-way interleaved cipher block chaining mode. And yes,
> I've been trying to work with LDS to change the current Crypt::CBC to
> have a 'compat' mode which would be 'SSLeay-compatible'.
This sounds great. It would also be very useful to have an SSH1-compatible
scheme; SSH1 uses a starting IV of all zeroes and basically just the "core"
CBC code. I could point out the main differences that I see between the
current Crypt::CBC and SSH1 compatibile CBC, if you'd be interested.
How are you proposing to work in the 'compat' mode? Using inheritance, or
using a has-a relationship, or through some other method?
Thanks,
Ben