Skip to content

Commit ae89317

Browse files
committed
Test that NULL Protection Profile is disabled
Resolves pion/srtp#297
1 parent 271ab55 commit ae89317

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

peerconnection_go_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"testing"
2323
"time"
2424

25+
"github.com/pion/dtls/v3"
2526
"github.com/pion/ice/v4"
2627
"github.com/pion/rtp"
2728
"github.com/pion/transport/v3/test"
@@ -1638,3 +1639,27 @@ func TestPeerConnectionDeadlock(t *testing.T) {
16381639

16391640
closePairNow(t, pcOffer, pcAnswer)
16401641
}
1642+
1643+
// Assert that by default NULL Ciphers aren't enabled. Even if
1644+
// the remote Peer Requests a NULL Cipher we should fail
1645+
func TestPeerConnectionNoNULLCipherDefault(t *testing.T) {
1646+
settingEngine := SettingEngine{}
1647+
settingEngine.SetSRTPProtectionProfiles(dtls.SRTP_NULL_HMAC_SHA1_80, dtls.SRTP_NULL_HMAC_SHA1_32)
1648+
offerPC, err := NewAPI(WithSettingEngine(settingEngine)).NewPeerConnection(Configuration{})
1649+
assert.NoError(t, err)
1650+
1651+
answerPC, err := NewPeerConnection(Configuration{})
1652+
assert.NoError(t, err)
1653+
1654+
assert.NoError(t, signalPair(offerPC, answerPC))
1655+
1656+
peerConnectionClosed := make(chan struct{})
1657+
answerPC.OnConnectionStateChange(func(s PeerConnectionState) {
1658+
if s == PeerConnectionStateClosed {
1659+
close(peerConnectionClosed)
1660+
}
1661+
})
1662+
1663+
<-peerConnectionClosed
1664+
closePairNow(t, offerPC, answerPC)
1665+
}

0 commit comments

Comments
 (0)