Skip to content

Commit

Permalink
Test that NULL Protection Profile is disabled
Browse files Browse the repository at this point in the history
Resolves pion/srtp#297
  • Loading branch information
Sean-Der committed Oct 28, 2024
1 parent 271ab55 commit ae89317
Showing 1 changed file with 25 additions and 0 deletions.
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)
}

0 comments on commit ae89317

Please sign in to comment.