Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 598

Cipher Block Chaining MAC (CBC-MAC) is a method of building a message authentication code from a block-cipher.

7 votes

Having CBC-MAC of a one block message, forge CBC-MAC of two blocks

Given just $a$ and $M(a)$, you can construct the message $a\,\|\,b$, where $b = a \oplus M(a)$, which gives the same CBC-MAC output $M(a\,\|\,b) = M(a)$ as $a$ itself. Indeed, we can append the block …
Ilmari Karonen's user avatar
8 votes
Accepted

CBC-MAC just to verify integrity

Yes, this is exactly what a message authentication code is for. Its job is to prevent an attacker from tampering with your message, or from forging completely bogus messages. For a secure MAC, it sh …
Ilmari Karonen's user avatar
2 votes

Why is ECBC-MAC with one key insecure?

Note that re-encrypting the output of CBC-MAC with the same key as it was calculated with is equivalent to appending a single all-zero cipher block to the message: $$E_K(\text{CBC-MAC}_K(m)) = E_K(\te …
Ilmari Karonen's user avatar
5 votes
Accepted

Is CBC mode encryption vulnerable to a reordering attack?

Yes. Assume that the attacker knows the ciphertext $c = c_1 \mathbin\| c_2$, the initialization vector $v$ and the plaintext $m = m_1 \mathbin\| m_2$. This tells them that $D_k(c_1) = m_1 \oplus v …
Ilmari Karonen's user avatar
7 votes

What is the correct way to implement PBKDF2 + AES CBC + HMAC?

IMO, you code looks pretty solid. A few things I might suggest taking a closer look at are: You haven't specified what iteration count you're using for PBKDF2. You should make the iteration count …
Ilmari Karonen's user avatar