-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define api for delegated credentials #67 #69
Conversation
@armfazh @lukevalenta @Lekensteyn ready for review now. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the API changes. One concern sticks out to me: If I'm understanding the code correctly, the client (resp. server) may use a DC whose signature algorithm isn't supported by the peer. I may be wrong :)
@cjpatton addressed now. Let me know what you think now ;)
When you get a DC from storage you check which one you will used based on the other's peer signature algorithm advertised by either the clientHelloInfo or certificateRequestInfo, so it will not be able to use anything that wasn't advertised there in the handshake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, the point of this change is to provide the DC in a single callback via GetCertificate rather than two (GetCertificate followed by GetDelegatedCredential)?
Could you include the motivation for the change in the commit message? Thanks, it looks good with minor comments!
@@ -446,7 +462,9 @@ func testServerGetCertificate(ch *ClientHelloInfo) (*Certificate, error) { | |||
} | |||
|
|||
if versOk && ch.SupportsDelegatedCredential { | |||
return dcTestCerts["dcP256"], nil | |||
serverCert := dcTestCerts["dcP256"] | |||
serverCert.DelegatedCredentials = serverDC[dcCount:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Note for my understanding: initDCTest
resets dcTestCerts
and dcTestCerts["dcCertP256"]
which is why it is okay for testServerGetCertificate
to have side-effects such as overwriting dcTestCerts["dcP256"].DelegatedCredentials
.)
I was wondering why serverDC[dcCount:]
was used. Would serverDC[dcCount:dcCount+1]
be sufficient to limit the test to a specific DC? Or is there a reason to include more than one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is more for testing with each specific DC and algorithm (a DC with ed25519, a Dc with eddsa256, etc). I'll prefer if the tests were only using one DC (it simplifies all) but is was requested by reviewers to test with them all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So based on a private chat with Sofía, my understanding is that it deliberately includes more than one to test this code path:
go/src/crypto/tls/handshake_server_tls13.go
Lines 464 to 472 in 1777b4c
for _, dcPair := range cert.DelegatedCredentials { | |
// The client must have sent the signature_algorithms in the DC extension: ensure it supports | |
// schemes we can use with this delegated credential. | |
if len(clientHello.SignatureSchemesDC) > 0 { | |
if _, err := selectSignatureSchemeDC(VersionTLS13, dcPair.DC, clientHello.SignatureSchemesDC); err == nil { | |
return &dcPair, nil | |
} | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One final question from me: From the tests it appears as if a DC may still be used in the connection even if support for DCs was not indicated by the peer. Is this an artifact of the test code, or is this what's actually happening?
Yes, the idea is to unify into single callback. I'll include in the commit message ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few nits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With an updated commit message with the motivation, it looks good to me.
…using the same mechanisms used to fetch certificates #67 Refactor new API Address comments from review Address comments from review 2 Address comments from review 3
Commit message has been changed. Merging now. |
crypto/tls: Implement draft-ietf-tls-subcerts-10 crypto/tls: fixes individual testing by adding insecure verify #62 crypto/tls: define api for delegated credentials so they are fetched using the same mechanisms used to fetch certificates #67 (#69) Refactor new API Address comments from review Address comments from review 2 Address comments from review 3 crypto/tls: allow the usage of other keyUsage when checking for the dc extension #72 (#73)
crypto/tls: Implement draft-ietf-tls-subcerts-10 crypto/tls: fixes individual testing by adding insecure verify #62 crypto/tls: define api for delegated credentials so they are fetched using the same mechanisms used to fetch certificates #67 (#69) Refactor new API Address comments from review Address comments from review 2 Address comments from review 3 crypto/tls: allow the usage of other keyUsage when checking for the dc extension #72 (#73)
crypto/tls: Implement draft-ietf-tls-subcerts-10 crypto/tls: fixes individual testing by adding insecure verify #62 crypto/tls: define api for delegated credentials so they are fetched using the same mechanisms used to fetch certificates #67 (#69) Refactor new API Address comments from review Address comments from review 2 Address comments from review 3 crypto/tls: allow the usage of other keyUsage when checking for the dc extension #72 (#73)
crypto/tls: Implement draft-ietf-tls-subcerts-10 crypto/tls: fixes individual testing by adding insecure verify #62 crypto/tls: define api for delegated credentials so they are fetched using the same mechanisms used to fetch certificates #67 (#69) Refactor new API Address comments from review Address comments from review 2 Address comments from review 3 crypto/tls: allow the usage of other keyUsage when checking for the dc extension #72 (#73)
crypto/tls: Implement draft-ietf-tls-subcerts-10 crypto/tls: fixes individual testing by adding insecure verify #62 crypto/tls: define api for delegated credentials so they are fetched using the same mechanisms used to fetch certificates #67 (#69) Refactor new API Address comments from review Address comments from review 2 Address comments from review 3 crypto/tls: allow the usage of other keyUsage when checking for the dc extension #72 (#73)
crypto/tls: Implement draft-ietf-tls-subcerts-10 crypto/tls: fixes individual testing by adding insecure verify #62 crypto/tls: define api for delegated credentials so they are fetched using the same mechanisms used to fetch certificates #67 (#69) Refactor new API Address comments from review Address comments from review 2 Address comments from review 3 crypto/tls: allow the usage of other keyUsage when checking for the dc extension #72 (#73)
crypto/tls: Implement draft-ietf-tls-subcerts-10 crypto/tls: fixes individual testing by adding insecure verify #62 crypto/tls: define api for delegated credentials so they are fetched using the same mechanisms used to fetch certificates #67 (#69) Refactor new API Address comments from review Address comments from review 2 Address comments from review 3 crypto/tls: allow the usage of other keyUsage when checking for the dc extension #72 (#73)
crypto/tls: Implement draft-ietf-tls-subcerts-10 crypto/tls: fixes individual testing by adding insecure verify #62 crypto/tls: define api for delegated credentials so they are fetched using the same mechanisms used to fetch certificates #67 (#69) Refactor new API Address comments from review Address comments from review 2 Address comments from review 3 crypto/tls: allow the usage of other keyUsage when checking for the dc extension #72 (#73)
Ready for review.
This should solve #63 as well.