Debian Codegraph @

srtp_cipher_aead_aes_gcm_rfc_test.go

raw symbols SCIP
1 // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
2 // SPDX-License-Identifier: MIT
3
4 package srtpscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/
5
6 import (
7 "encoding/hexscip-go gomod github.com/golang/go/src go1.21 `encoding/hex`/"
8 "stringsscip-go gomod github.com/golang/go/src go1.21 strings/"
9 "testingscip-go gomod github.com/golang/go/src go1.21 testing/"
10
11 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/"
12 )
13
14 func fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#, s string) []byte {
15 t.Helperscip-go gomod github.com/golang/go/src go1.21 testing/common#Helper().()
16
17 s = stringsscip-go gomod github.com/golang/go/src go1.21 strings/.ReplaceAllscip-go gomod github.com/golang/go/src go1.21 strings/ReplaceAll().(s, " ", "")
18 s = stringsscip-go gomod github.com/golang/go/src go1.21 strings/.ReplaceAllscip-go gomod github.com/golang/go/src go1.21 strings/ReplaceAll().(s, "\n", "")
19 s = stringsscip-go gomod github.com/golang/go/src go1.21 strings/.ReplaceAllscip-go gomod github.com/golang/go/src go1.21 strings/ReplaceAll().(s, "\t", "")
20 s = stringsscip-go gomod github.com/golang/go/src go1.21 strings/.ReplaceAllscip-go gomod github.com/golang/go/src go1.21 strings/ReplaceAll().(s, "\r", "")
21 b, err := hexscip-go gomod github.com/golang/go/src go1.21 `encoding/hex`/.DecodeStringscip-go gomod github.com/golang/go/src go1.21 `encoding/hex`/DecodeString().(s)
22 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
23
24 return b
25 }
26
27 type testRfcAeadCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher# struct {
28 profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile. ProtectionProfilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/ProtectionProfile# // Protection profile
29 keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys. derivedSessionKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys# // Derived session keys
30
31 decryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTPPacket. []byte
32 encryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#encryptedRTPPacket. []byte
33 authenticatedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#authenticatedRTPPacket. []byte
34
35 decryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTCPPacket. []byte
36 encryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#encryptedRTCPPacket. []byte
37 authenticatedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#authenticatedRTCPPacket. []byte
38 }
39
40 // createRfcAeadTestCiphers returns a list of test ciphers for the RFC test vectors.
41 func createRfcAeadTestCiphersscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/createRfcAeadTestCiphers().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) []testRfcAeadCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher# {
42 t.Helperscip-go gomod github.com/golang/go/src go1.21 testing/common#Helper().()
43 tests := []testRfcAeadCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#{}
44
45 // AES-128-GCM, RFC 7714, Sections 16 and 17
46 aes128Gcm := testRfcAeadCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#{
47 profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile.: ProtectionProfileAeadAes128Gcmscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/ProtectionProfileAeadAes128Gcm.,
48 keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys.: derivedSessionKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#{
49 srtpSessionKeyscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtpSessionKey.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f`),
50 srtpSessionSaltscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtpSessionSalt.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `51 75 69 64 20 70 72 6f 20 71 75 6f`),
51 },
52 decryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `8040f17b 8041f8d3 5501a0b2 47616c6c
53 69612065 7374206f 6d6e6973 20646976
54 69736120 696e2070 61727465 73207472
55 6573`),
56 encryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#encryptedRTPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `8040f17b 8041f8d3 5501a0b2 f24de3a3
57 fb34de6c acba861c 9d7e4bca be633bd5
58 0d294e6f 42a5f47a 51c7d19b 36de3adf
59 8833899d 7f27beb1 6a9152cf 765ee439
60 0cce`),
61 authenticatedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#authenticatedRTPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `8040f17b 8041f8d3 5501a0b2 47616c6c
62 69612065 7374206f 6d6e6973 20646976
63 69736120 696e2070 61727465 73207472
64 65732249 3f82d2bc e397e9d7 9e3b19aa
65 4216`),
66 decryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTCPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `81c8000d 4d617273 4e545031 4e545032
67 52545020 0000042a 0000e930 4c756e61
68 deadbeef deadbeef deadbeef deadbeef
69 deadbeef`),
70 encryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#encryptedRTCPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `81c8000d 4d617273 63e94885 dcdab67c
71 a727d766 2f6b7e99 7ff5c0f7 6c06f32d
72 c676a5f1 730d6fda 4ce09b46 86303ded
73 0bb9275b c84aa458 96cf4d2f c5abf872
74 45d9eade 800005d4`),
75 authenticatedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#authenticatedRTCPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `81c8000d 4d617273 4e545031 4e545032
76 52545020 0000042a 0000e930 4c756e61
77 deadbeef deadbeef deadbeef deadbeef
78 deadbeef 841dd968 3dd78ec9 2ae58790
79 125f62b3 000005d4`),
80 }
81 aes128Gcm.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys..srtcpSessionKeyscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtcpSessionKey. = aes128Gcm.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys..srtpSessionKeyscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtpSessionKey.
82 aes128Gcm.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys..srtcpSessionSaltscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtcpSessionSalt. = aes128Gcm.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys..srtpSessionSaltscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtpSessionSalt.
83 tests = append(tests, aes128Gcm)
84
85 // AES-256-GCM, RFC 7714, Sections 16 and 17
86 aes256Gcm := testRfcAeadCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#{
87 profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile.: ProtectionProfileAeadAes256Gcmscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/ProtectionProfileAeadAes256Gcm.,
88 keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys.: derivedSessionKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#{
89 srtpSessionKeyscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtpSessionKey.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
90 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f`),
91 srtpSessionSaltscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtpSessionSalt.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `51 75 69 64 20 70 72 6f 20 71 75 6f`),
92 },
93 decryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `8040f17b 8041f8d3 5501a0b2 47616c6c
94 69612065 7374206f 6d6e6973 20646976
95 69736120 696e2070 61727465 73207472
96 6573`),
97 encryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#encryptedRTPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `8040f17b 8041f8d3 5501a0b2 32b1de78
98 a822fe12 ef9f78fa 332e33aa b1801238
99 9a58e2f3 b50b2a02 76ffae0f 1ba63799
100 b87b7aa3 db36dfff d6b0f9bb 7878d7a7
101 6c13`),
102 authenticatedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#authenticatedRTPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `8040f17b 8041f8d3 5501a0b2 47616c6c
103 69612065 7374206f 6d6e6973 20646976
104 69736120 696e2070 61727465 73207472
105 6573a866 d5910f88 7463067c eefec452
106 15d4`),
107 decryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTCPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `81c8000d 4d617273 4e545031 4e545032
108 52545020 0000042a 0000e930 4c756e61
109 deadbeef deadbeef deadbeef deadbeef
110 deadbeef`),
111 encryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#encryptedRTCPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `81c8000d 4d617273 d50ae4d1 f5ce5d30
112 4ba297e4 7d470c28 2c3ece5d bffe0a50
113 a2eaa5c1 110555be 8415f658 c61de047
114 6f1b6fad 1d1eb30c 4446839f 57ff6f6c
115 b26ac3be 800005d4`),
116 authenticatedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#authenticatedRTCPPacket.: fromHexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/fromHex().(t, `81c8000d 4d617273 4e545031 4e545032
117 52545020 0000042a 0000e930 4c756e61
118 deadbeef deadbeef deadbeef deadbeef
119 deadbeef 91db4afb feee5a97 8fab4393
120 ed2615fe 000005d4`),
121 }
122 aes256Gcm.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys..srtcpSessionKeyscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtcpSessionKey. = aes256Gcm.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys..srtpSessionKeyscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtpSessionKey.
123 aes256Gcm.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys..srtcpSessionSaltscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtcpSessionSalt. = aes256Gcm.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys..srtpSessionSaltscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/derivedSessionKeys#srtpSessionSalt.
124 tests = append(tests, aes256Gcm)
125
126 return tests
127 }
128
129 func TestAeadCiphersWithRfcTestVectorsscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/TestAeadCiphersWithRfcTestVectors().(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
130 for _, testCase := range createRfcAeadTestCiphersscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/createRfcAeadTestCiphers().(t) {
131 t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile..Stringscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/ProtectionProfile#String().(), func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
132 t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().("Encrypt RTP", func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
133 cipher, err := newSrtpCipherAeadAesGcmWithDerivedKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/newSrtpCipherAeadAesGcmWithDerivedKeys().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., testCase.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys., true, true)
134 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
135 ctx, err := createContextWithCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/createContextWithCipher().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., cipher)
136 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
137 ctx.SetIndexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#SetIndex().(0x4d617273, 0x000005d3)
138
139 actualEncrypted, err := ctx.EncryptRTPscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#EncryptRTP().(nil, testCase.decryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTPPacket., nil)
140 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
141 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, testCase.encryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#encryptedRTPPacket., actualEncrypted)
142 })
143
144 t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().("Decrypt RTP", func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
145 cipher, err := newSrtpCipherAeadAesGcmWithDerivedKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/newSrtpCipherAeadAesGcmWithDerivedKeys().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., testCase.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys., true, true)
146 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
147 ctx, err := createContextWithCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/createContextWithCipher().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., cipher)
148 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
149 ctx.SetIndexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#SetIndex().(0x4d617273, 0x000005d3)
150
151 actualDecrypted, err := ctx.DecryptRTPscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#DecryptRTP().(nil, testCase.encryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#encryptedRTPPacket., nil)
152 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
153 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, testCase.decryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTPPacket., actualDecrypted)
154 })
155
156 t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().("Encrypt RTCP", func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
157 cipher, err := newSrtpCipherAeadAesGcmWithDerivedKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/newSrtpCipherAeadAesGcmWithDerivedKeys().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., testCase.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys., true, true)
158 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
159 ctx, err := createContextWithCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/createContextWithCipher().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., cipher)
160 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
161 ctx.SetIndexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#SetIndex().(0x4d617273, 0x000005d3)
162
163 actualEncrypted, err := ctx.EncryptRTCPscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#EncryptRTCP().(nil, testCase.decryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTCPPacket., nil)
164 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
165 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, testCase.encryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#encryptedRTCPPacket., actualEncrypted)
166 })
167
168 t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().("Decrypt RTCP", func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
169 cipher, err := newSrtpCipherAeadAesGcmWithDerivedKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/newSrtpCipherAeadAesGcmWithDerivedKeys().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., testCase.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys., true, true)
170 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
171 ctx, err := createContextWithCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/createContextWithCipher().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., cipher)
172 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
173 ctx.SetIndexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#SetIndex().(0x4d617273, 0x000005d3)
174
175 actualDecrypted, err := ctx.DecryptRTCPscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#DecryptRTCP().(nil, testCase.encryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#encryptedRTCPPacket., nil)
176 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
177 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, testCase.decryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTCPPacket., actualDecrypted)
178 })
179
180 t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().("Encrypt RTP with NULL cipher", func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
181 cipher, err := newSrtpCipherAeadAesGcmWithDerivedKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/newSrtpCipherAeadAesGcmWithDerivedKeys().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., testCase.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys., false, false)
182 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
183 ctx, err := createContextWithCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/createContextWithCipher().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., cipher)
184 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
185 ctx.SetIndexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#SetIndex().(0x4d617273, 0x000005d3)
186
187 actualEncrypted, err := ctx.EncryptRTPscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#EncryptRTP().(nil, testCase.decryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTPPacket., nil)
188 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
189 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, testCase.authenticatedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#authenticatedRTPPacket., actualEncrypted)
190 })
191
192 t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().("Decrypt RTP with NULL cipher", func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
193 cipher, err := newSrtpCipherAeadAesGcmWithDerivedKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/newSrtpCipherAeadAesGcmWithDerivedKeys().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., testCase.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys., false, false)
194 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
195 ctx, err := createContextWithCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/createContextWithCipher().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., cipher)
196 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
197 ctx.SetIndexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#SetIndex().(0x4d617273, 0x000005d3)
198
199 actualDecrypted, err := ctx.DecryptRTPscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#DecryptRTP().(nil, testCase.authenticatedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#authenticatedRTPPacket., nil)
200 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
201 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, testCase.decryptedRTPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTPPacket., actualDecrypted)
202 })
203
204 t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().("Encrypt RTCP with NULL cipher", func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
205 cipher, err := newSrtpCipherAeadAesGcmWithDerivedKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/newSrtpCipherAeadAesGcmWithDerivedKeys().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., testCase.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys., false, false)
206 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
207 ctx, err := createContextWithCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/createContextWithCipher().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., cipher)
208 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
209 ctx.SetIndexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#SetIndex().(0x4d617273, 0x000005d3)
210
211 actualEncrypted, err := ctx.EncryptRTCPscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#EncryptRTCP().(nil, testCase.decryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTCPPacket., nil)
212 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
213 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, testCase.authenticatedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#authenticatedRTCPPacket., actualEncrypted)
214 })
215
216 t.Runscip-go gomod github.com/golang/go/src go1.21 testing/T#Run().("Decrypt RTCP with NULL cipher", func(t *testingscip-go gomod github.com/golang/go/src go1.21 testing/.Tscip-go gomod github.com/golang/go/src go1.21 testing/T#) {
217 cipher, err := newSrtpCipherAeadAesGcmWithDerivedKeysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/newSrtpCipherAeadAesGcmWithDerivedKeys().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., testCase.keysscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#keys., false, false)
218 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
219 ctx, err := createContextWithCipherscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/createContextWithCipher().(testCase.profilescip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#profile., cipher)
220 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
221 ctx.SetIndexscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#SetIndex().(0x4d617273, 0x000005d3)
222
223 actualDecrypted, err := ctx.DecryptRTCPscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/Context#DecryptRTCP().(nil, testCase.authenticatedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#authenticatedRTCPPacket., nil)
224 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
225 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, testCase.decryptedRTCPPacketscip-go gomod github.com/pion/srtp/v3 . `github.com/pion/srtp/v3`/testRfcAeadCipher#decryptedRTCPPacket., actualDecrypted)
226 })
227 })
228 }
229 }