Skip to content
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
GoogleCodeExporter opened this issue Mar 7, 2015 · 10 comments

Comments

@GoogleCodeExporter
Copy link

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

jbtule added a commit to jbtule/keyczar that referenced this issue May 3, 2016
Review based changes
  - Possible extraneous memory alloc
  - whitespace fixes

Conflicts:

	java/code/src/org/keyczar/Verifier.java
@jbtule
Copy link
Contributor

jbtule commented May 20, 2016

This issue can be closed!!

@sweis sweis closed this as completed Mar 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants