Ring Daemon
16.0.0
Loading...
Searching...
No Matches
sdes_negotiator.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16
*/
17
#pragma once
18
19
#include "
media/media_codec.h
"
20
21
#include <stdexcept>
22
#include <string>
23
#include <vector>
24
25
using namespace
std::literals;
26
27
namespace
jami
{
28
34
class
ParseError
:
public
std::invalid_argument
35
{
36
public
:
37
explicit
ParseError
(
const
std::string& error)
38
:
std
::invalid_argument(error)
39
{}
40
};
41
42
enum
CipherMode
{
AESCounterMode
,
AESF8Mode
};
43
44
enum
MACMode
{
HMACSHA1
};
45
46
enum
KeyMethod
{
47
Inline
48
// url, maybe at some point
49
};
50
51
struct
CryptoSuiteDefinition
52
{
53
std::string_view
name
;
54
int
masterKeyLength
;
55
int
masterSaltLength
;
56
int
srtpLifetime
;
57
int
srtcpLifetime
;
58
CipherMode
cipher
;
59
int
encryptionKeyLength
;
60
MACMode
mac
;
61
int
srtpAuthTagLength
;
62
int
srtcpAuthTagLength
;
63
int
srtpAuthKeyLength
;
64
int
srtcpAuthKeyLen
;
65
};
66
72
static
std::vector<CryptoSuiteDefinition>
CryptoSuites
= {
73
{
"AES_CM_128_HMAC_SHA1_80"
sv
, 128, 112, 48, 31,
AESCounterMode
, 128,
HMACSHA1
, 80, 80, 160, 160},
74
75
{
"AES_CM_128_HMAC_SHA1_32"
sv
, 128, 112, 48, 31,
AESCounterMode
, 128,
HMACSHA1
, 32, 80, 160, 160},
76
77
{
"F8_128_HMAC_SHA1_80"
sv
, 128, 112, 48, 31,
AESF8Mode
, 128,
HMACSHA1
, 80, 80, 160, 160}};
78
79
class
SdesNegotiator
80
{
81
public
:
82
SdesNegotiator
();
83
84
static
CryptoAttribute
negotiate
(
const
std::vector<std::string>&
attributes
);
85
86
inline
explicit
operator
bool
()
const
{
return
not
CryptoSuites
.empty(); }
87
88
private
:
89
static
std::vector<CryptoAttribute> parse(
const
std::vector<std::string>&
attributes
);
90
};
91
92
}
// namespace jami
jami::CryptoAttribute
Definition
media_codec.h:175
jami::ParseError
General exception object that is thrown when an error occurred with a regular expression operation.
Definition
sdes_negotiator.h:35
jami::ParseError::ParseError
ParseError(const std::string &error)
Definition
sdes_negotiator.h:37
jami::SdesNegotiator
Definition
sdes_negotiator.h:80
jami::SdesNegotiator::SdesNegotiator
SdesNegotiator()
jami::SdesNegotiator::negotiate
static CryptoAttribute negotiate(const std::vector< std::string > &attributes)
Definition
sdes_negotiator.cpp:137
media_codec.h
jami
Definition
account.cpp:61
jami::MACMode
MACMode
Definition
sdes_negotiator.h:44
jami::HMACSHA1
@ HMACSHA1
Definition
sdes_negotiator.h:44
jami::emitSignal
void emitSignal(Args... args)
Definition
ring_signal.h:64
jami::CryptoSuites
static std::vector< CryptoSuiteDefinition > CryptoSuites
List of accepted Crypto-Suites as defined in RFC4568 (6.2)
Definition
sdes_negotiator.h:72
jami::CipherMode
CipherMode
Definition
sdes_negotiator.h:42
jami::AESCounterMode
@ AESCounterMode
Definition
sdes_negotiator.h:42
jami::AESF8Mode
@ AESF8Mode
Definition
sdes_negotiator.h:42
jami::KeyMethod
KeyMethod
Definition
sdes_negotiator.h:46
jami::Inline
@ Inline
Definition
sdes_negotiator.h:47
std
Definition
rational.h:263
jami::CryptoSuiteDefinition
Definition
sdes_negotiator.h:52
jami::CryptoSuiteDefinition::srtpAuthKeyLength
int srtpAuthKeyLength
Definition
sdes_negotiator.h:63
jami::CryptoSuiteDefinition::srtcpLifetime
int srtcpLifetime
Definition
sdes_negotiator.h:57
jami::CryptoSuiteDefinition::encryptionKeyLength
int encryptionKeyLength
Definition
sdes_negotiator.h:59
jami::CryptoSuiteDefinition::name
std::string_view name
Definition
sdes_negotiator.h:53
jami::CryptoSuiteDefinition::cipher
CipherMode cipher
Definition
sdes_negotiator.h:58
jami::CryptoSuiteDefinition::srtpAuthTagLength
int srtpAuthTagLength
Definition
sdes_negotiator.h:61
jami::CryptoSuiteDefinition::srtpLifetime
int srtpLifetime
Definition
sdes_negotiator.h:56
jami::CryptoSuiteDefinition::mac
MACMode mac
Definition
sdes_negotiator.h:60
jami::CryptoSuiteDefinition::srtcpAuthTagLength
int srtcpAuthTagLength
Definition
sdes_negotiator.h:62
jami::CryptoSuiteDefinition::srtcpAuthKeyLen
int srtcpAuthKeyLen
Definition
sdes_negotiator.h:64
jami::CryptoSuiteDefinition::masterKeyLength
int masterKeyLength
Definition
sdes_negotiator.h:54
jami::CryptoSuiteDefinition::masterSaltLength
int masterSaltLength
Definition
sdes_negotiator.h:55
src
sip
sdes_negotiator.h
Generated on Thu Jun 19 2025 15:50:38 for Ring Daemon by
1.9.8