2:02 PM
Now, let's go through these one at a time.
I'm not going to read this entire section, as I know how MACs work. Cryptographic protocols cannot be separated out and used as you see fit. They must be used in a larger context, that is, each protocol is used for its purpose and supports another. So, MAC is used for Integrity Protection, NOT Authentication, even though that word is in the name and even though this section appears to say otherwise. Bear with me, I will explain that.
Here's the important quote from this section. It's what I've been saying all along, so hopefully, you can begin to trust what I say: "Message authentication is said to protect the integrity of a message, ensuring that each message that it is received and deemed acceptable is arriving in the same condition that it was sent out—with no bits inserted, missing, or modified."
That last bit was for the link from CSEWEB.UCSD.EDU Chapter 7. This is an excellent chapter for you to read and understand some of the attacks that are possible on MAC.
You refer me to the question you asked on Nov 10 (
security.stackexchange.com/questions/105160/…). I haven't even bothered to answer this one because the current answer is excellent. Notice, the author writes: "It's really difficult to answer your question of "how to use it correctly", because we don't know anything about your use case."
I will address the other links above in a moment. However, I want to point out that in a comment on security exchange, I said you've designed a protocol and you said you didn't. Storing key codes, trying to protect against key theft, MAC'ing network messages and checking those MACs at another machine IS a protocol. Just because you don't see it that way doesn't make it true. As I've designed, built, broken and improved protocols, I know one when I see one.
"Protocol" definition from MW dictionary: a system of rules that explain the correct conduct and procedures to be followed in formal situations.
Wiki link: I'm not sure why you keep sending this to me. You'll have to provide some context. I know the word "Authenticate" appears in MAC, that doesn't mean what you think it means. If you want to stay focused on it, you're not going to learn.
The first link for security stack exchange has the finest of points: Why do you need MAC in addition to encryption? The accepted answer argues that it Authentication is really the point of MAC, not Integrity. Does this counter everything I've said? Not really. Here's why, even that author is confused on a very subtle point and we can see it in his comment.
He writes: "The ability to prove that a message was generated by a particular party" THAT IS THE POINT. MAC is about proving a message originated with a PARTICULAR party. The reason I'm calling out your protocol as insecure and ad-hoc is because you are missing the proof of the other party.
You need to state the problem you are trying to solve. The problem you are trying to solve is not numbers 1,2,&3 above. In fact, it wasn't even #3 (replay attacks) until I pointed it out. These things are steps in a security protocol. You've taken some crypto algorithms, slapped them together and are trying to build SOMETHING.
What is that something? What are you trying to achieve at a higher level. Then, we can talk about the best way to approach it.
Next, your question "do I disagree with above?" I neither agree nor disagree because I cannot tell what you really need, only what you're asking for. And, the questions you're asking indicate you don't understand the nature of the thing you're trying to do. Which is why I'm here helping you. I'd like you to (a) understand all of this better (b) prevent you from making the mistake of building an insecure system and (c) help you build a more secure system.
So, please don't ask about these things, right now. Just tell me what the problem is that you have (not key storage and MAC problems, but the security over all problem, what does these messages do, how do they fit into your system).
If you want to trust me, go check out my linked in page and my credentials. I spent the better part of decade securing computer systems, including time at Oracle where I advised 100's of application development teams; improving their security and improving database security. There were (and still are) a lot of problems there created because people failed to do things right the first time. I want you to do this right from the beginning.