I have such situation. I have a device like dongle. But it has certain limitations. For example, it can only have implemented encryption and decryption functionality.
The availability of ciphers which it can use it can use is also limited. Current option is 3DES.
Now, I need to create a message authentication scheme (which gives both integrity and authenticity) from this situation. I know ideally HMAC, CBC-MAC, should be used, but we don't have that situation.
I am interested would such option be considered a somewhat secure MAC:
- I want to authenticate message M
- I apply hash on message M say SHA1, e.g.
M' = SHA1(M). This I do from my PC which is more powerful than my dongle, HASP.
I feed the device-HASP, with M' (there is an issue here, please see below), it encrypts it with a key, e.g.,
TAG = 3DES_ECB_ENCRYPT(M', KEY)
The 3rd step is done because to avoid sending lot of data to the device.
TAG is the authentication tag, which I will send together with message M.
This is the scheme basically:
My problems and questions are:
- You know 3DES block size is 8 bytes, how can I feed it with output of SHA1 (in a secure way) which is 20 bytes? Or what workaround exists for it?
- How secure is my MAC?
I know this is not the most secure, but like I said we have some limitations, and are ok with it if it is not catastrophic mac scheme. e.g. our current MAC was just DEC ECB encryption, of XORED plain text. So now instead of XOR ing plain text blocks between each other we use SHA1. Old scheme is described here.
PS. Similar approach is mentioned here: https://cseweb.ucsd.edu/~mihir/cse207/w-mac.pdf, but there whole plain text is given to encryption function, here I can't do that - I can't give 200 bytes of data say to the dongle, that is why I want to hash it first, and give smaller amount of data to the device