Ring Daemon
Loading...
Searching...
No Matches
sdes_negotiator.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2004-2026 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
:
uint8_t
{
AESCounterMode
,
AESF8Mode
};
43
44
enum
MACMode
:
uint8_t
{
HMACSHA1
};
45
46
struct
CryptoSuiteDefinition
47
{
48
std::string_view
name
;
49
int
masterKeyLength
;
50
int
masterSaltLength
;
51
int
srtpLifetime
;
52
int
srtcpLifetime
;
53
CipherMode
cipher
;
54
int
encryptionKeyLength
;
55
MACMode
mac
;
56
int
srtpAuthTagLength
;
57
int
srtcpAuthTagLength
;
58
int
srtpAuthKeyLength
;
59
int
srtcpAuthKeyLen
;
60
};
61
67
static
std::vector<CryptoSuiteDefinition>
CryptoSuites
68
= {{
"AES_CM_128_HMAC_SHA1_80"
sv
, 128, 112, 48, 31,
AESCounterMode
, 128,
HMACSHA1
, 80, 80, 160, 160},
69
70
{
"AES_CM_128_HMAC_SHA1_32"
sv
, 128, 112, 48, 31,
AESCounterMode
, 128,
HMACSHA1
, 32, 80, 160, 160},
71
72
{
"F8_128_HMAC_SHA1_80"
sv
, 128, 112, 48, 31,
AESF8Mode
, 128,
HMACSHA1
, 80, 80, 160, 160}};
73
74
class
SdesNegotiator
75
{
76
public
:
77
SdesNegotiator
();
78
79
static
CryptoAttribute
negotiate
(
const
std::vector<std::string>&
attributes
);
80
81
inline
explicit
operator
bool
()
const
{
return
not
CryptoSuites
.empty(); }
82
83
private
:
84
static
std::vector<CryptoAttribute> parse(
const
std::vector<std::string>&
attributes
);
85
};
86
87
}
// 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:75
jami::SdesNegotiator::SdesNegotiator
SdesNegotiator()
jami::SdesNegotiator::negotiate
static CryptoAttribute negotiate(const std::vector< std::string > &attributes)
Definition
sdes_negotiator.cpp:134
media_codec.h
jami
Definition
account.cpp:56
jami::emitSignal
void emitSignal(Args... args)
Definition
jami_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:68
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::MACMode
MACMode
Definition
sdes_negotiator.h:44
jami::HMACSHA1
@ HMACSHA1
Definition
sdes_negotiator.h:44
std
Definition
rational.h:262
jami::CryptoSuiteDefinition
Definition
sdes_negotiator.h:47
jami::CryptoSuiteDefinition::srtpAuthKeyLength
int srtpAuthKeyLength
Definition
sdes_negotiator.h:58
jami::CryptoSuiteDefinition::srtcpLifetime
int srtcpLifetime
Definition
sdes_negotiator.h:52
jami::CryptoSuiteDefinition::encryptionKeyLength
int encryptionKeyLength
Definition
sdes_negotiator.h:54
jami::CryptoSuiteDefinition::name
std::string_view name
Definition
sdes_negotiator.h:48
jami::CryptoSuiteDefinition::cipher
CipherMode cipher
Definition
sdes_negotiator.h:53
jami::CryptoSuiteDefinition::srtpAuthTagLength
int srtpAuthTagLength
Definition
sdes_negotiator.h:56
jami::CryptoSuiteDefinition::srtpLifetime
int srtpLifetime
Definition
sdes_negotiator.h:51
jami::CryptoSuiteDefinition::mac
MACMode mac
Definition
sdes_negotiator.h:55
jami::CryptoSuiteDefinition::srtcpAuthTagLength
int srtcpAuthTagLength
Definition
sdes_negotiator.h:57
jami::CryptoSuiteDefinition::srtcpAuthKeyLen
int srtcpAuthKeyLen
Definition
sdes_negotiator.h:59
jami::CryptoSuiteDefinition::masterKeyLength
int masterKeyLength
Definition
sdes_negotiator.h:49
jami::CryptoSuiteDefinition::masterSaltLength
int masterSaltLength
Definition
sdes_negotiator.h:50
src
sip
sdes_negotiator.h
Generated on Fri Apr 3 2026 14:23:10 for Ring Daemon by
1.9.8