DTLS-SRTP: which shape fits, an SSLSocket over a datagram transport or a connection over memory BIOs?
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- ruby
- Lĩnh vực
- backend-api-design, networking, security
Hướng nghiên cứu
Read the existing transport work in #736 and #1000 and the earlier DTLS draft in #171, then compare the two proposed API shapes against the listed OpenSSL DTLS, SRTP, BIO, MTU, and retransmission requirements. The issue asks maintainers to choose a shape before implementation; a first step is to get agreement on that API. Done means the selected shape supports both handshake roles, SRTP profile selection, key export, peer certificates, and retransmission handling across supported library versions.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The use case
DTLS-SRTP (RFC 5764) is how every WebRTC endpoint, and many SIP media servers, key their media: a DTLS handshake on the media port, then the SRTP keys taken from the TLS exporter ("EXTRACTOR-dtls_srtp") and the peer's certificate checked against the fingerprint in the SDP.
The DTLS here cannot own the socket. One UDP 5-tuple carries STUN, DTLS and SRTP, told apart by the first byte of each datagram (RFC 7983), so the program reads the socket itself, keeps STUN and SRTP, and hands the DTLS datagrams to the TLS layer; the TLS layer's datagrams go back out through the same socket.
ruby/openssl already has the after-handshake half: SSLSocket#export_keying_material and #peer_cert. What is missing is the handshake itself:
- a context made with
DTLS_method()(anSSLContextis alwaysTLS_method()today) SSL_CTX_set_tlsext_use_srtpandSSL_get_selected_srtp_profile- the retransmission timer,
DTLSv1_get_timeout/DTLSv1_handle_timeout(macros, so not reachable through an FFI either) - the MTU,
SSL_set_mtuwithSSL_OP_NO_QUERY_MTU - a transport that is not the socket's file descriptor
#171 was a socket-based DTLS draft in 2017. Before writing anything, I'd like to ask which shape would fit here, since #736 (and #1000) are already changing how an SSLSocket meets a transport that is not an fd.
Shape A: SSLSocket over a datagram transport
ctx = OpenSSL::SSL::SSLContext.new(:DTLS) # DTLS_method(); the spelling is open
ctx.tlsext_use_srtp = "SRTP_AES128_CM_SHA1_80"
ssl = OpenSSL::SSL::SSLSocket.new(transport, ctx)
ssl.mtu = 1200
ssl.accept_nonblock(exception: false) # or connect, per the SDP's a=setup
ssl.dtls_timeout # seconds until a retransmit is due, or nil
ssl.dtls_handle_timeout
ssl.selected_srtp_profile # "SRTP_AES128_CM_SHA1_80"
ssl.export_keying_material("EXTRACTOR-dtls_srtp", 60)
With a connected UDPSocket as transport this needs nothing from #736. For the demultiplexed case, transport would be an IO-like object on #736 whose write_nonblock sends one datagram and read_nonblock answers one; the BIO_METHOD there would also have to answer the datagram controls DTLS asks of its BIO (BIO_CTRL_DGRAM_QUERY_MTU, BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, ...).
Shape B: a connection over memory BIOs
The shape pyOpenSSL has (Connection(ctx, None) with bio_write / bio_read): no transport at all, the program pumps datagrams in and out.
conn = OpenSSL::SSL::Connection.new(ctx) # SSL_new over two memory BIOs
conn.set_accept_state # or set_connect_state
conn.bio_write(datagram) # one that arrived
conn.do_handshake(exception: false) # true, or :wait_readable
while (out = conn.bio_read) # one datagram per call, nil when none
sock.send(out, 0, peer)
end
The timer, selected_srtp_profile, export_keying_material and peer_cert as in shape A. BIO_s_dgram_mem (OpenSSL 3.2+) keeps datagram boundaries; on a plain BIO_s_mem a read gave several records run together (1573 and 1860 bytes against a 1200-byte MTU in my tests), so before 3.2 the datagrams would have to be split by record.
What I can do
I can implement whichever shape you prefer, with tests for both handshake roles in-process and against openssl s_server -dtls / s_client -dtls with -use_srtp and -keymatexport, a dropped datagram for the timer, and the library versions the gem supports, with DTLS and SRTP feature-detected in extconf where a library lacks them. A prototype of shape B (through an FFI, on OpenSSL 4.1) completes the handshake between two in-process endpoints, selects SRTP_AES128_CM_SHA1_80 on both, derives the same 60-byte exporter on both, and each side's peer_cert fingerprint matches the other's certificate.
Context: Spinel, an ahead-of-time Ruby compiler whose openssl package follows ruby/openssl's API and spelling, needs this for a media server, and its maintainer asked that a DTLS API be proposed here first (matz/spinel#12740).
🤖 Generated with Claude Code
- Ngôn ngữ chính
- C
- Star
- 276
- Fork
- 208
- Merge trung bình
- 22 giờ 57 phút
- Pull request đã merge (30 ngày)
- 20
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ruby/openssl
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 8/100
ruby/openssl#1163 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SSLSocket#syswrite no longer raises IOError after IO#closeCó thể đã có người làm @sourya2704 đã nhận 4 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add OpenSSL::SSL::SSLContext#client_hello_cb= (binding for SSL_CTX_set_client_hello_cb())Có thể đã có người làm @kou đã nhận 46 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 53/100
ruby/openssl#1125 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Documenting how to use OpenSSL::SSL::SSLContext in PQC use casesCó thể đã có người làm @junaruga đã nhận 32 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
ruby/openssl#1118 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Expose XOFs like SHAKE128 and SHAKE256Có thể đã có người làm @rhenium đã nhận 142 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
ruby/openssl#1082 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Cyberpunk not listed in readmeĐang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Polprzewodnikowy/N64FlashcartMenu#486 · 3 bình luận ·
-
docs: EigenLua is labelled private in docs/CI.md and consumer_acceptance.sh, but the repo is publicĐang mởarea:docs kind:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
InauguralSystems/EigenScript#2602 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[raygui] update to 5.0Đang mởcategory:port-update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 2 ngày