Trouble with keyAuthorization for DNS ("Provided key authorization was incorrect") [SOLVED]


#1

This is all on the staging server…

Given a public RSA key:

{"e":"AQAB","kty":"RSA","n":"AL7XV3uXI1jx_42Z0yteCszQ2amSL6sNr9_cXRcWuVHWsxfm8yRgrKEt-318-uB7VqjHRqYDmOnNCsLnnU1lBRYPDkShJQyzEgbjGnfR8PuoKyq614OsgAUYs2M4_Jo2A214aOwzxCuCfdpmcKRY9auF1q1dN8qzwU7KepAi3le_WegeOcZqyMoSeOlWqaTkGNiOw-0eh6eTd2q0RhH3yjD5pKQwuhcOaT9vCCXLCgN5nbqkj6aL_zPc7a-HajpdSNXmTEZwMhOEguSWI1tjby3RfOFUSDCCyBcPiZbuqwsJZKvT0sepEVJ1-97hsOKt0pdd3G8dowd-KowhpI6BW3jts8zpCv_6tWkx7sb4csZ52SWlKSBvQOoYj40EseAUE_DIRAaBLR3fhXjNgEfRSw1t6ORqI_zi7la7xx1wV444E9NYKKoKca53733_dtP0AkPwj2WohEmHiYH2zRKXaSekBxSlLJNkw4K9Wu1_BXC3XihLMzpBSPNXVYUTN9K3l_YYo9WTDDhgqThTKKxKC3mlw77v3Pfxud_Ri7jez2d0jNCbQR0q3M1WHGuPqthdCBxyqPTgfu5P_QHi7LxMT6hxfFGNBC4AC3zz_5e7tWLE4Sc9xYBtkZrx2puOST53dbsPh9KbvYE_DlB4Bc65dQkhw4QnZcnTVUxcK_-pVZNx"}

And a challenge token:

UAhplVzpLSflIXKmlPpSuSsJc8ktpXNJ2TUdr194JXg

I compute DNS TXT field to be:

ZRYsNnI4_zPuoBXVnhKWbyA4zRCYZ88h-GXeqcRp40Q

And keyAuthorization to be:

UAhplVzpLSflIXKmlPpSuSsJc8ktpXNJ2TUdr194JXg.QAfe8gXBNEL5ZF6kN1mdJxpFjdEiEb0hbV7vK4QqUjA

When I post to /acme/challenge/$STRING/$NUMBER I post the following JSON body (signed and wrapped the same way as all the other requests that succeed):

{
  "resource":"challenge",
  "keyAuthorization":"UAhplVzpLSflIXKmlPpSuSsJc8ktpXNJ2TUdr194JXg.QAfe8gXBNEL5ZF6kN1mdJxpFjdEiEb0hbV7vK4QqUjA"
}

Response is:

{
  "type": "urn:acme:error:malformed",
  "detail": "Unable to update challenge :: Provided key authorization was incorrect",
  "status": 400
}

Given these inputs, am I supposed to compute something different?


#2

We had a release go to staging today that caused issues and was reverted. If this happened around ~19:00 UTC and isn’t happening anymore then I suspect the bad release was at fault.


#3

Unfortunately I received the Provided key authorization was incorrect response yesterday, and confirmed that is what I’m getting back, again, just now. (I did see the staging release, but that demonstrated itself via 500s)


#4

I’ve also noticed similar problem being reported in the dehydrated repo.


#5

I have now compared the output of my code with go-jose implementation and I can verify that I’m computing the same thumbprint as computed in go-jose jwk_test.go https://github.com/square/go-jose/blob/aec45e462a68387ffcfa5496966d7a28e46fb04f/jwk_test.go#L501 for the key https://github.com/square/go-jose/blob/aec45e462a68387ffcfa5496966d7a28e46fb04f/jwk_test.go#L416

Is my input incorrect in some way? I don’t understand why “Provided key authorization was incorrect” is what I’m getting.


#6

Hi @tristanls

Can you provide me your registration ID or the domain you’re testing this with? I can check the server-side logs and see if there is any information that might help identify what the problem you’re facing is.


#7

registrationID: 315305, https://acme-staging.api.letsencrypt.org/acme/reg/315305

the challenge I’ve been pounding against:

/acme/challenge/f8gkAVA07026XXv8joH6TFwe1BwLff-ZB5LfeyvwIKs/14030252


#8

@cpu I compared what I’ve been doing with certbot/acme/acme/jose … I think I might know what the problem is.

In the input I provided for the n parameter of RSA key:

AL7XV3uXI1jx_42Z0yteCszQ2amSL6sNr9_cXRcWuVHWsxfm8yRgrKEt-318-uB7VqjHRqYDmOnNCsLnnU1lBRYPDkShJQyzEgbjGnfR8PuoKyq614OsgAUYs2M4_Jo2A214aOwzxCuCfdpmcKRY9auF1q1dN8qzwU7KepAi3le_WegeOcZqyMoSeOlWqaTkGNiOw-0eh6eTd2q0RhH3yjD5pKQwuhcOaT9vCCXLCgN5nbqkj6aL_zPc7a-HajpdSNXmTEZwMhOEguSWI1tjby3RfOFUSDCCyBcPiZbuqwsJZKvT0sepEVJ1-97hsOKt0pdd3G8dowd-KowhpI6BW3jts8zpCv_6tWkx7sb4csZ52SWlKSBvQOoYj40EseAUE_DIRAaBLR3fhXjNgEfRSw1t6ORqI_zi7la7xx1wV444E9NYKKoKca53733_dtP0AkPwj2WohEmHiYH2zRKXaSekBxSlLJNkw4K9Wu1_BXC3XihLMzpBSPNXVYUTN9K3l_YYo9WTDDhgqThTKKxKC3mlw77v3Pfxud_Ri7jez2d0jNCbQR0q3M1WHGuPqthdCBxyqPTgfu5P_QHi7LxMT6hxfFGNBC4AC3zz_5e7tWLE4Sc9xYBtkZrx2puOST53dbsPh9KbvYE_DlB4Bc65dQkhw4QnZcnTVUxcK_-pVZNx

I use this urlbase64 encoding of the number n to calculate the thumbprint. What I assume your server is doing, and this is what https://github.com/certbot/certbot/blob/master/acme/acme/jose/jwk.py#L45 is doing, is that instead of using the provided urlbase64 encoding to calculate the thumbprint, it is parsed into a number, and leading zeros are removed and then encoded into urlbase64, and thumbprint is calculated from that.

When I removed leading zeros, I end up with the same thumbprint as https://github.com/certbot/certbot/blob/master/acme/acme/jose/jwk.py#L45 .

Yup… just confirmed that’s the case. I was able to initiate the challenge check.


Java Let's encrypt client problem with jre 1.8
DNS Verification
#9

Hi @tristanls

I’m glad you were able to figure out a solution!

I checked into what Boulder was doing and it does appear that the library we’re using for Jose will strip leading zeroes as you suspected.

Thanks for your patience! I learned something new too :slight_smile:


#10

I opened Issue 275 with dehydrated to help address this for their code base (and to help with the issue you found while debugging).

Thanks again!


#11

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.