@@ -101,9 +101,6 @@ var (
101101 }
102102
103103 ResponseIndex = 0
104- Response = core.Challenge {
105- Type : "simpleHttp" ,
106- }
107104
108105 ExampleCSR = & x509.CertificateRequest {}
109106
@@ -128,6 +125,19 @@ const (
128125 saDBConnStr = "mysql+tcp://boulder@localhost:3306/boulder_sa_test"
129126)
130127
128+ func makeResponse (ch core.Challenge ) (out core.Challenge , err error ) {
129+ jsonAuthorizedKey , err := json .Marshal (core.AuthorizedKey {
130+ Token : ch .Token ,
131+ Key : ch .AccountKey ,
132+ })
133+ if err != nil {
134+ return
135+ }
136+
137+ out = core.Challenge {AuthorizedKey : jsonAuthorizedKey }
138+ return
139+ }
140+
131141func initAuthorities (t * testing.T ) (* DummyValidationAuthority , * sa.SQLStorageAuthority , * RegistrationAuthorityImpl , clock.FakeClock , func ()) {
132142 err := json .Unmarshal (AccountKeyJSONA , & AccountKeyA )
133143 test .AssertNotError (t , err , "Failed to unmarshal public JWK" )
@@ -406,7 +416,9 @@ func TestUpdateAuthorization(t *testing.T) {
406416 authz , err := ra .NewAuthorization (AuthzRequest , Registration .ID )
407417 test .AssertNotError (t , err , "NewAuthorization failed" )
408418
409- authz , err = ra .UpdateAuthorization (authz , ResponseIndex , Response )
419+ response , err := makeResponse (authz .Challenges [ResponseIndex ])
420+ test .AssertNotError (t , err , "Unable to construct response to challenge" )
421+ authz , err = ra .UpdateAuthorization (authz , ResponseIndex , response )
410422 test .AssertNotError (t , err , "UpdateAuthorization failed" )
411423
412424 // Verify that returned authz same as DB
@@ -440,7 +452,9 @@ func TestUpdateAuthorizationReject(t *testing.T) {
440452 test .AssertNotError (t , err , "UpdateRegistration failed" )
441453
442454 // Verify that the RA rejected the authorization request
443- _ , err = ra .UpdateAuthorization (authz , ResponseIndex , Response )
455+ response , err := makeResponse (authz .Challenges [ResponseIndex ])
456+ test .AssertNotError (t , err , "Unable to construct response to challenge" )
457+ _ , err = ra .UpdateAuthorization (authz , ResponseIndex , response )
444458 test .AssertEquals (t , err , core .UnauthorizedError ("Challenge cannot be updated with a different key" ))
445459
446460 t .Log ("DONE TestUpdateAuthorizationReject" )
0 commit comments