I am very new to Crypto and need some clarification or input. The question is:
Suppose that Alice wants to encrypt a message for Bob, where the message consists of three plaintext blocks, $P_0$, $P_1$, and $P_2$ - Alice and Bob have access to a hash function and a shared symmetric key $K$, but no cipher is available. How can Alice securely encrypt the message so that Bob can decrypt it?
What I had came up with appears to work but seems way too complicated.
Alice can compute an HMAC using the hash function, message and key for integrity and send it to Bob like so:
- Let $M$ = the plaintext consisting of $p_0, p_1, p_2$,
- Let $B$ be the block length of hash in bytes,
ipad = 0x36
repeated $B$ times,opad = ox5C
repeated $B$ times.
Then the HMAC of $M$ is defined to be:
$$HMAC(M, K) = H(K \oplus opad, H(K \oplus ipad, M))$$
Since there is no cipher for the symmetric key, Alice can send Bob a public key where only she has the private key. From here she can send the ciphertext $C = [M]$. Alice to Bob and Bob can verify decrypting ${M}Alice = M$ and plugging it into $HMAC(M, K) = H(K \oplus opad, H(K \oplus ipad, M))$ is consistent with what Alice had originally sent.
First, is this a way to encrypt/decrypt a message? Second, is there an easier way? No cipher available means the message cannot simply be encrypted/decrypted with the symmetric key, correct?