4 ms·
Yeah, coming up with your own signature scheme to verify authenticity with certain properties is very difficult but also very different in kind from running a p
by pclmulqdq 2y ago
Yeah, coming up with your own signature scheme to verify authenticity with certain properties is very difficult but also very different in kind from running a pre-designed scheme using a library baked by someone else.
I think you have a pre-defined notion when I say the word "signature" about what I meant (perhaps something about software signing or SSL certificates). I literally meant "checking that HMAC-SHA-2 of some bytes is what you expect" (using a library for the hash). Incidentally, that's how you authenticate a JWT.
- g_p 2y agoI recently came across a signature check that was (correctly) checking the signature against a public key... The issue was the public key itself was unauthenticated, and provided by the (signed) ciphertext itself... Meaning the crypto was fine, but it wasn't checking anything meaningful, as any rogue message would just include its own public key in the message! It's not only about the raw operation of checking bytes are equal (hopefully in a constant time manner, if applicable), but also about ensuring the desired security properties are actually present in the application!
- quadhome 2y agoA JWT? Me me! I've seen this done wrong! - memcmp(actual_sig, expected_sig) == 0 - strcmp(actual_sig_base64, expected_sig_base64) == 0 - strcasecmp(actual_sig_base64, expected_sig_base64) == 0