I'm trying to understand this blog post about JOSE. In the part about JWS, it says the following:
Including the public key in the protected header would not only give the server the ability the validate the signature, we will also be sure that it is the correct one since the protected header is integrity protected!
This is what the example object looks like:
{
"payload": "eyAKICAgICAgICAiZnJvbSI6ewogICAgICAgICAgICAibmFtZSI6ICJUaW0gWXNld3luIiwKICAgICAgICAgICAgImFjY291bnQiOiAiQ2hlY2tpbmcgYWNjb3VudCIKICAgICAgICB9LAogICAgICAgICJ0byI6ewogICAgICAgICAgICAibmFtZSI6ICJUaW0gWXNld3luIiwKICAgICAgICAgICAgImFjY291bnQiOiAiU2F2aW5ncyBhY2NvdW50IgogICAgICAgIH0sCiAgICAgICAgImFtb3VudCI6IDI1MAogICAgICAgICJjdXJyZW5jeSI6ICJFVVIiCiAgICB9",
"protected": "eyAKICAgICAgICAiYWxnIjogIlJTMjU2IgogICAgfQ==",
"header": {
"signature": "DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8ISlSApmWQxfKTUJqPP3-Kg6NU01Q"
}
}
The protected header is the base64url
encoding of:
{
"alg": "ES256"
}
The only reference I can find to putting a public key in there is the use of the key id field kid
like so:
{"alg":"RSA1_5","kid":"2011-04-29"}
Is this what the post is referring to? Or is it referring to something else (like putting the entire public key into the protected header as:
{"alg":"RSA1_5","key":"somepublickeyhere"}