What is HMAC good for vs. public key cryptography? (question only)
(This post doesn't answer the question. It's just the question and some exploration.)
I notice that Amazon's S3 API uses HMAC for message authentication, and I wonder why that is. I think other APIs do this too (Twilio?), so I think it's not just a weird Amazon thing. However, it's not clear to me why you'd want to use HMAC over say asymmetric cryptography/digital signatures. Why not authenticate yourself to AWS using a public key? Why not validate their response using their public key?
Key space doesn't seem like a factor. In theory using asymmetric cryptography means 4x as many keys floating around, and 3x as many for each party to store ("my" private key, and both public keys). But cryptographic keys are pretty small relative to for example images stored in an S3 bucket. Because of that I don't think the space required for keys is the reason.
Wikipedia claims that HMAC is nice because it doesn't need "a complex public key infrastructure." However, it claims this is by "delegating the key exchange to the communicating parties." Why can't the parties just do the same thing for the public key exchange? Why would they want or need "a complex public key infrastructure" and why wouldn't they need such a thing when using HMAC? It's not obvious to me what the benefit is here.
Maybe in the future I'll revisit this question and try to actually answer it.