Skip to content
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

Include test vectors in specifications #459

Closed
thomaseizinger opened this issue Sep 23, 2022 · 5 comments · Fixed by #464
Closed

Include test vectors in specifications #459

thomaseizinger opened this issue Sep 23, 2022 · 5 comments · Fixed by #464

Comments

@thomaseizinger
Copy link
Contributor

Whilst reviewing the rust-libp2p implementation of the QUIC transport, I took a closer look at the TLS specification: https://github.com/libp2p/specs/blob/master/tls/tls.md

What do people think about including test vectors in there? I am thinking something like:

  • Given ed25519 identity keypair X
  • Given certificate keypair
  • A valid certificate with the custom libp2p protocol extension looks like XYZ

This would make it possible to easily write unit tests against this fairly critical part of the code and would potentially catch interoperability issues early on.

@marten-seemann
Copy link
Contributor

Sounds like a good idea. Want to create a PR? I’d create a test case for go-libp2p as part of reviewing that PR.

@thomaseizinger
Copy link
Contributor Author

I'll see to put some test vectors together from the current Rust implementation!

@thomaseizinger
Copy link
Contributor Author

This is proving trickier than I thought it would. Creating test vectors for parsing a certificate is easy but generation is difficult because the ECDSA signature of the certificate itself incorporates randomness.

@thomaseizinger
Copy link
Contributor Author

I guess parsing could be enough? Implementations can always write round-trip tests where they try to parse their own certificates. If that passes, generation should be okay too!

@thomaseizinger
Copy link
Contributor Author

I am adding tests with a static inputs in libp2p/rust-libp2p#2945.

Here is a direct link: https://github.com/libp2p/rust-libp2p/blob/3b76e39c68192318111fd9142df5a79f281c3bf6/transports/tls/src/certificate.rs#L497-L544

Do you want to test these against the go implementation? Once successful, I can PR them to the spec.

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 a pull request may close this issue.

2 participants