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

[peer_connection] allow persistent certificates #204

Merged

Conversation

melekes
Copy link
Contributor

@melekes melekes commented Jun 21, 2022

Closes #168

This PR adds RTCCertificate::from_existing method, which constructs RTCCertificate from an existing DTLS certificate. An existing certificate might be needed in cases like this where you need DTLS identity to be fixed for some period of time (whole duration of the certificate or some part of it).

also, make `pem` and `expires` fields private
and add `RTCCertificate::new` method, which gives a way to construct a
`RTCCertificate` using an already generated certificate (as opposed to
generating a new one using `from_params` or `from_key_pair` methods).

Fixes webrtc-rs#168
otherwise, it's not possible to reuse the same config across N peer
connections.
@codecov
Copy link

codecov bot commented Jun 21, 2022

Codecov Report

Merging #204 (500124c) into master (d0ceb9b) will increase coverage by 0.06%.
The diff coverage is 76.92%.

@@            Coverage Diff             @@
##           master     #204      +/-   ##
==========================================
+ Coverage   43.56%   43.63%   +0.06%     
==========================================
  Files          68       68              
  Lines        9499     9514      +15     
  Branches     2739     2736       -3     
==========================================
+ Hits         4138     4151      +13     
- Misses       3371     3374       +3     
+ Partials     1990     1989       -1     
Impacted Files Coverage Δ
src/peer_connection/configuration.rs 82.35% <ø> (ø)
src/peer_connection/certificate.rs 56.19% <76.92%> (+0.27%) ⬆️
src/sctp_transport/sctp_transport_state.rs 66.66% <0.00%> (ø)
src/lib.rs 19.20% <0.00%> (+0.07%) ⬆️
src/error.rs 4.87% <0.00%> (+0.55%) ⬆️
src/mux/mux_func.rs 78.57% <0.00%> (+3.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0ceb9b...500124c. Read the comment docs.

Copy link
Member

@k0nserv k0nserv left a comment

Choose a reason for hiding this comment

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

LGTM

@melekes
Copy link
Contributor Author

melekes commented Jun 21, 2022

NOTE: this method does not exist in Go's Pion, but I believe adding it is reasonable.

@rainliu any thoughts?

@melekes melekes merged commit 46fd086 into webrtc-rs:master Jul 4, 2022
@melekes melekes deleted the anton/168-allow-persistent-certificates branch July 4, 2022 08:26
@melekes
Copy link
Contributor Author

melekes commented Jul 4, 2022

Merged for now. We can always revert if needed since it's not breaking anything.

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.

[DTLS] allow providing custom certificates
2 participants