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

Test that NULL Protection Profile is disabled #2939

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions peerconnection_go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"testing"
"time"

"github.com/pion/dtls/v3"
"github.com/pion/ice/v4"
"github.com/pion/rtp"
"github.com/pion/transport/v3/test"
Expand Down Expand Up @@ -1638,3 +1639,27 @@ func TestPeerConnectionDeadlock(t *testing.T) {

closePairNow(t, pcOffer, pcAnswer)
}

// Assert that by default NULL Ciphers aren't enabled. Even if
// the remote Peer Requests a NULL Cipher we should fail
func TestPeerConnectionNoNULLCipherDefault(t *testing.T) {
settingEngine := SettingEngine{}
settingEngine.SetSRTPProtectionProfiles(dtls.SRTP_NULL_HMAC_SHA1_80, dtls.SRTP_NULL_HMAC_SHA1_32)
offerPC, err := NewAPI(WithSettingEngine(settingEngine)).NewPeerConnection(Configuration{})
assert.NoError(t, err)

answerPC, err := NewPeerConnection(Configuration{})
assert.NoError(t, err)

assert.NoError(t, signalPair(offerPC, answerPC))

peerConnectionClosed := make(chan struct{})
answerPC.OnConnectionStateChange(func(s PeerConnectionState) {
if s == PeerConnectionStateClosed {
close(peerConnectionClosed)
}
})

<-peerConnectionClosed
closePairNow(t, offerPC, answerPC)
}
Loading