Skip to content

Have CreateReplies() check for mismatched server#59

Merged
cjpatton merged 2 commits intomasterfrom
cjpatton/53-4-check-srv-before-replying
Aug 8, 2024
Merged

Have CreateReplies() check for mismatched server#59
cjpatton merged 2 commits intomasterfrom
cjpatton/53-4-check-srv-before-replying

Conversation

@cjpatton
Copy link
Contributor

@cjpatton cjpatton commented Aug 7, 2024

The same certificate is used for all requests, so we expect each client to indicate the same server.

This entails a bit of refactoring: instead of passing a list of nonces to CreateReplies(), pass the requests themselves.

Replace the sequence of nonces with the sequence of `Request` structures
that encapsulate them.
The same certificate is used for all requests, so we expect each client
to indicate the same server.
@cjpatton cjpatton marked this pull request as ready for review August 7, 2024 21:19
@cjpatton cjpatton requested a review from lukevalenta August 7, 2024 21:19
for _, ver := range allVersions {
t.Run(ver.String(), func(t *testing.T) {
nonce1, _, _, err := CreateRequest([]Version{ver}, rand.Reader, nil, rootPublicKeyA)
_, _, req1Bytes, err := CreateRequest([]Version{ver}, rand.Reader, nil, rootPublicKeyA)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it's a little redundant to have CreateRequest return the nonce, given that it can be parsed from the request bytes, but no harm in keeping it for convenience.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, if we dropped this then the client would have to parse the nonce from the request in order to verify the response.

A nicer alternative might be to return an actual *Request that the client encodes itself. I suggest we address this in a future PR since it's not related to this one.

@cjpatton cjpatton merged commit ed03988 into master Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants