Tag Info

New answers tagged

2

HMAC is generally more applicable to situations where two entities want to communicate securely over the internet. It provides two key things, confidentiality and integrity. confidentiality by proving the remote client has possession of the "secret" ingredient, integrity, through validation of message digest. In your use case, local storage encryption, ...


3

Here are some weaknesses (the first one is the most serious): If you do not include the encryption IV in the input to HMAC, then attackers could modify the IV and induce a corresponding change in the message without being detected. Similarly, the attacker could modify SALT1 or ITERATIONS1; the HMAC would still match, but you would get junk upon decryption. ...


1

Before I give my answer, lets first go over the subject of HMAC. Hash-based message authentication code (or HMAC) is a mechanism for calculating a message authentication code involving a hash function in combination with a secret key. This can be used to verify the integrity and authenticity of a a message. Now HMAC authentication guarantees the ...


1

HMAC is a keyed message authentication code construction. As Bernie mentioned in the comments, an attacker who does not have your secret key (assuming the implementation is strong, of course), cannot create a valid HMAC for modified data. The answer to your second question: "How long should my key length be?" depends on the specific hash function that ...


0

Appending the hash then encrypting the whole lot is not necessarily secure. Actually, depending on the encryption system, it may be awfully weak. For instance, suppose that encryption is done with a stream cipher such as RC4: encryption is done by XORing with a key-dependent pseudorandom stream. Thus, the attacker sees this:    E = (m || ...


0

On one hand, it's inefficient. The receiver would have to go through all the work of looking up the key, decrypting the message before learning if it was even worth decrypting it. Similarly, it adds risk. If the MAC doesn't compute, the receiver would never even retrieve the keys needed to decrypt the message, and the receiver wouldn't ever have your ...


0

I just became familiar with the Padding Oracle attack outlined in the article you linked, and I believe you answered your own question. If the Padding Oracle attack can lead to full discovery of the plain-text, encrypting the unencrypted message message AND the hash would still require padding, and thusly make it vulnerable to discovery. To implement both, ...


1

Since javascript uses UTF-16 strings, I suspect it is expecting a UTF-16 encoded string. Just to clarify, your first parameter should be a hash algorithm ('sha1', 'md5', etc.) not the data to be encrypted.



Top 50 recent answers are included