

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 6
click for more info
Not enough gems
Cost: 6 gems
1: What Is a Message Integrity?
incomplete
2: Message Authentication Code (MAC)
incomplete
3: Message Authentication Code (MAC)
incomplete
4: Hash-Based Message Authentication Code
incomplete
5: Toy HMAC
incomplete
6: MACs and JWTs
incomplete
7: Asymmetric JWTs
incomplete
8: Asymmetric JWT Review
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
JWTs that use HMACs are symmetric signatures. We talked about how they use the same key to sign and validate the tokens. This works well in some scenarios, but let's take the example of third-party authentication, like "Sign in with Google".
Asymmetric JWTs use a private key to sign the JSON payload, and a public key to validate it, it's similar to asymmetric encryption, but instead of encrypting data, we're signing it.
ECDSA, or Elliptic Curve Digital Signature Algorithm, is a type of asymmetric signature algorithm. It works using the same elliptic curve math that we talked about in the chapter on asymmetric encryption.
Let's take a look at how the Boot.dev web app uses asymmetric JWTs for our "Sign in with Google" button.
"Sign in with Google", "Sign in with GitHub", "Sign in with Twitter", etc. are all examples of third-party authentication. They reduce the friction of creating an account on a new website, so many websites use them.
Passly wants to be an issuer of JWTs. Our massive egos demand that we push clients into using "Sign in with Passly".
Complete the createECDSAMessage() function.
MESSAGE.signature
Where MESSAGE is the original message, and signature is the signature of the hashed message in lowercase hex.
Keep in mind, this isn't a full JWT, it's an arbitrary message and a signature.