5

I'm looking for a one-way hash function that can be performed by A on an encrypted piece of data E(D) provided by B, without the performer A able to figure out D or H(D). This similar to HMAC(Message, Key), except the output hash cannot be known by A.

Usage:

  • B encrypts data D => E(D)
  • B sends E(D) to A
  • A contains a secret key SK
  • A performs F(E(D), SK) => E(H(D))
  • A sends E(H(D)) to B
  • B decrypts E(H(D)) => H(D)

Constraints:

  • A cannot recover D
  • A cannot recover H(D) from E(H(D))
  • B cannot recover SK from E(H(D)) or H(D)

I believe there may be a solution involving public/private key cryptography, but I'm not about to roll my own.

mikeazo
  • 39,117
  • 9
  • 118
  • 183

1 Answers1

3

If you are not limited to HMAC, blind signatures would meet your requirements.

In RSA, you can do blind signatures as follows:

Let $M$ be the message to be signed (probably the hash of a message) and let $e,N$ be A's public key, $d$ is A's private key.

B computes $M' = M\cdot r^e \bmod{N}$ and sends $M'$ to A.
A computes $S' = M'^d\bmod{N}$ and sends it to B.
B computes $S = S'\cdot r^{-1}\bmod{N} = M^d\bmod{N}$ (i.e., $M$ signed with A's private key).

I am not aware of any libraries that support this scheme out of the box, but it wouldn't be too hard to add the functionality. Also, other cryptosystems would support this idea too.

Homomorphic Encryption
Using fully homomorphic encryption, this would be very possible to do. You would just need to implement a homomorphic version of a hash function and build it up into an HMAC function. Given current public-key homomorphic technology, it would be very slow. Still, though, this technology is too new for deployment.

Garbled Circuits
Another option for implementing HMAC that should meet the requirements you have stated is garbled circuits. Garbled circuits can evaluate AES privately much faster than even the most optimized version of homomorphic AES. Which suggests that a hash function could be practical to compute using a garbled circuit.

mikeazo
  • 39,117
  • 9
  • 118
  • 183