This repository was archived by the owner on Dec 29, 2022. It is now read-only.
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
Java doesn't produce the same hash for non 128 bit keysizes of AES as C++&Python #105
Closed
Description
What steps will reproduce the problem?
http://code.google.com/p/keyczar/source/browse/java/code/src/org/keyczar/AesKey.
java#119
byte[] fullHash = Util.hash(Util.fromInt(BLOCK_SIZE), aesBytes,
hmacKey.getEncoded());
What is the expected output? What do you see instead?
byte[] fullHash = Util.hash(Util.fromInt(aesBytes.length), aesBytes,
hmacKey.getEncoded());
so that it is compatable with:
http://code.google.com/p/keyczar/source/browse/python/src/keyczar/keys.py#341
fullhash = util.Hash(util.IntToBytes(len(self.key_bytes)),
self.key_bytes,
self.hmac_key.key_bytes)
or
http://code.google.com/p/keyczar/source/browse/cpp/src/keyczar/key.cc#202
digest_impl.Update(util::Int32ToByteString(trimmed_field->size()));
digest_impl.Update(*trimmed_field);
or wiki:
http://code.google.com/p/keyczar/wiki/KeyHash
4-byte integer valued length of the raw AES key bytes
Raw AES key bytes
Raw HMAC key bytes
What version of the product are you using? On what operating system?
Rev 275f433163c1
Original issue reported on code.google.com by jtu...@gmail.com
on 11 Sep 2012 at 12:56