Skip to content

Commit c5c816a

Browse files
committed
Added header blocks to DTLS SRTP classes. Switched DTLS transport from using an underlying socket to a memory stream.
1 parent e64aa11 commit c5c816a

22 files changed

+625
-597
lines changed

LICENSE.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2006-2019, Aaron Clauson
1+
Copyright (c) 2006-2020, Aaron Clauson
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -10,3 +10,26 @@ Redistribution and use in source and binary forms, with or without modification,
1010
* Neither the names SIP Sorcery, Aaron Clauson nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
1111

1212
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13+
14+
Derivative Works:
15+
-----------------
16+
17+
Portions of the DTLS/SRTP implmentation are derived from the jitsi SRTP library, see https://github.com/jitsi/jitsi-srtp.
18+
The license for the derivative source code is the Apcache License, Version 2.0 with specific conditions listed immediately below.
19+
20+
/*
21+
* Copyright @ 2015 - present 8x8, Inc
22+
*
23+
* Licensed under the Apache License, Version 2.0 (the "License");
24+
* you may not use this file except in compliance with the License.
25+
* You may obtain a copy of the License at
26+
*
27+
* http://www.apache.org/licenses/LICENSE-2.0
28+
*
29+
* Unless required by applicable law or agreed to in writing, software
30+
* distributed under the License is distributed on an "AS IS" BASIS,
31+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32+
* See the License for the specific language governing permissions and
33+
* limitations under the License.
34+
*/
35+

examples/icecmdline/Program.cs

-31
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
using WebSocketSharp;
3131
using WebSocketSharp.Net.WebSockets;
3232
using WebSocketSharp.Server;
33-
using Org.BouncyCastle.Crypto.DtlsSrtp;
3433

3534
namespace SIPSorcery.Examples
3635
{
@@ -175,17 +174,6 @@ private static RTCPeerConnection Createpc(WebSocketContext context)
175174

176175
var pc = new RTCPeerConnection(pcConfiguration);
177176

178-
#if DTLS_IS_ENABLED
179-
//SIPSorceryMedia.DtlsHandshake dtls = new SIPSorceryMedia.DtlsHandshake(DTLS_CERTIFICATE_PATH, DTLS_KEY_PATH);
180-
//dtls.Debug = true;
181-
182-
//var certificate = DtlsUtils.CreateSelfSignedCert();
183-
//DtlsSrtpTransport dtlsHandle = new DtlsSrtpTransport(
184-
// pc.IceRole == IceRolesEnum.active ?
185-
// (IDtlsSrtpPeer)new DtlsSrtpClient(certificate) :
186-
// (IDtlsSrtpPeer)new DtlsSrtpServer(certificate));
187-
#endif
188-
189177
// Add inactive audio and video tracks.
190178
MediaStreamTrack audioTrack = new MediaStreamTrack(SDPMediaTypesEnum.audio, false, new List<SDPMediaFormat> { new SDPMediaFormat(SDPMediaFormatsEnum.PCMU) }, MediaStreamStatusEnum.RecvOnly);
191179
pc.addTrack(audioTrack);
@@ -234,25 +222,6 @@ private static RTCPeerConnection Createpc(WebSocketContext context)
234222
var dtlsResult = await DoDtlsHandshake(pc, dtlsHandle);
235223
logger.LogDebug($"DTLS handshake result {dtlsResult}.");
236224
});
237-
238-
//if (pc.IceRole == IceRolesEnum.active)
239-
//{
240-
// logger.LogDebug("Starting DTLS handshake as client task.");
241-
// _ = Task.Run(() =>
242-
// {
243-
// bool handshakedResult = DoDtlsHandshake(pc, dtls, true, pc.RemotePeerDtlsFingerprint);
244-
// logger.LogDebug($"DTLS handshake result {handshakedResult}.");
245-
// });
246-
//}
247-
//else
248-
//{
249-
// logger.LogDebug("Starting DTLS handshake as server task.");
250-
// _ = Task.Run(() =>
251-
// {
252-
// bool handshakedResult = DoDtlsHandshake(pc, dtls, false, pc.RemotePeerDtlsFingerprint);
253-
// logger.LogDebug($"DTLS handshake result {handshakedResult}.");
254-
// });
255-
//}
256225
#endif
257226
}
258227
}

examples/icecmdline/icecmdline.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>netcoreapp3.1</TargetFramework>
6-
<Platforms>AnyCPU;x64</Platforms>
6+
<Platforms>AnyCPU</Platforms>
77
</PropertyGroup>
88

99
<PropertyGroup>

examples/icecmdline/icecmdline.sln

-20
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,17 @@ EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1212
Debug|Any CPU = Debug|Any CPU
13-
Debug|x64 = Debug|x64
14-
Debug|x86 = Debug|x86
1513
Release|Any CPU = Release|Any CPU
16-
Release|x64 = Release|x64
17-
Release|x86 = Release|x86
1814
EndGlobalSection
1915
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2016
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2117
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Debug|Any CPU.Build.0 = Debug|Any CPU
22-
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Debug|x64.ActiveCfg = Debug|x64
23-
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Debug|x64.Build.0 = Debug|x64
24-
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Debug|x86.ActiveCfg = Debug|Any CPU
25-
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Debug|x86.Build.0 = Debug|Any CPU
2618
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Release|Any CPU.ActiveCfg = Release|Any CPU
2719
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Release|Any CPU.Build.0 = Release|Any CPU
28-
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Release|x64.ActiveCfg = Release|Any CPU
29-
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Release|x64.Build.0 = Release|Any CPU
30-
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Release|x86.ActiveCfg = Release|Any CPU
31-
{57F5815C-E435-4AC0-9AC1-A6502F4BE345}.Release|x86.Build.0 = Release|Any CPU
3220
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3321
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
34-
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Debug|x64.ActiveCfg = Debug|Any CPU
35-
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Debug|x64.Build.0 = Debug|Any CPU
36-
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Debug|x86.ActiveCfg = Debug|Any CPU
37-
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Debug|x86.Build.0 = Debug|Any CPU
3822
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
3923
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Release|Any CPU.Build.0 = Release|Any CPU
40-
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Release|x64.ActiveCfg = Release|Any CPU
41-
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Release|x64.Build.0 = Release|Any CPU
42-
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Release|x86.ActiveCfg = Release|Any CPU
43-
{D1CE96A3-7591-486F-A7C3-5ABC41EBE8AE}.Release|x86.Build.0 = Release|Any CPU
4424
EndGlobalSection
4525
GlobalSection(SolutionProperties) = preSolution
4626
HideSolutionNode = FALSE

examples/icecmdline/testsdp.html

-94
This file was deleted.

src/LICENSE.md

-12
This file was deleted.

0 commit comments

Comments
 (0)