Implments the SRTP encryption modes as defined in RFC3711.
More...
#include <SrtpSymCrypto.h>
Collaboration diagram for SrtpSymCrypto:
Public Member Functions
Constructor that initializes key data.
More...
void
encrypt (const uint8_t *input, uint8_t *output)
Encrypts the inpout to the output.
More...
Computes the cipher stream for AES CM mode.
More...
void
ctr_encrypt (const uint8_t *input, uint32_t inputLen, uint8_t *output, uint8_t *iv)
void
ctr_encrypt (uint8_t *data, uint32_t data_length, uint8_t *iv)
Counter-mode encryption, in place.
More...
Derive a AES context to compute the IV'.
More...
AES F8 mode encryption, in place.
More...
Private Member Functions
Private Attributes
Detailed Description
Constructor & Destructor Documentation
SrtpSymCrypto::SrtpSymCrypto
(
uint8_t *
key,
int32_t
key_length,
)
Constructor that initializes key data.
- Parameters
-
key Pointer to key bytes.
key_length Number of key bytes.
Definition at line 53 of file gcryptSrtpSymCrypto.cpp.
SrtpSymCrypto::~SrtpSymCrypto
(
)
Member Function Documentation
void SrtpSymCrypto::ctr_encrypt
(
const uint8_t *
input,
uint32_t
inputLen,
uint8_t *
output,
uint8_t *
iv
)
Counter-mode encryption.
This method performs the AES CM encryption.
- Parameters
-
input Pointer to input buffer, must be inputLen bytes.
inputLen Number of bytes to process.
output Pointer to output buffer, must be inputLen bytes.
iv The initialization vector as input to create the cipher stream. Refer to chapter 4.1.1 in RFC 3711.
Definition at line 151 of file gcryptSrtpSymCrypto.cpp.
void SrtpSymCrypto::ctr_encrypt
(
uint8_t *
data,
uint32_t
data_length,
uint8_t *
iv
)
Counter-mode encryption, in place.
This method performs the AES CM encryption.
- Parameters
-
data Pointer to input and output block, must be dataLen bytes.
data_length Number of bytes to process.
iv The initialization vector as input to create the cipher stream. Refer to chapter 4.1.1 in RFC 3711.
Definition at line 184 of file gcryptSrtpSymCrypto.cpp.
void SrtpSymCrypto::encrypt
(
const uint8_t *
input,
uint8_t *
output
)
Encrypts the inpout to the output.
Encrypts one input block to one output block. Each block is 16 bytes according to the AES encryption algorithm used.
- Parameters
-
input Pointer to input block, must be 16 bytes
output Pointer to output block, must be 16 bytes
Definition at line 117 of file gcryptSrtpSymCrypto.cpp.
uint8_t *
key,
int32_t
keyLen,
uint8_t *
salt,
int32_t
saltLen
)
Derive a AES context to compute the IV'.
See chapter 4.1.2.1 in RFC 3711.
- Parameters
-
f8Cipher Pointer to the AES context that will be used to encrypt IV to IV'
key The master key
keyLen Length of the master key.
salt Master salt.
saltLen length of master salt.
Definition at line 224 of file gcryptSrtpSymCrypto.cpp.
void SrtpSymCrypto::f8_encrypt
(
const uint8_t *
data,
uint32_t
dataLen,
uint8_t *
iv,
)
AES F8 mode encryption, in place.
This method performs the AES F8 encryption, see chapter 4.1.2 in RFC 3711.
- Parameters
-
data Pointer to input and output block, must be dataLen bytes.
dataLen Number of bytes to process.
iv The initialization vector as input to create the cipher stream. Refer to chapter 4.1.1 in RFC 3711.
f8Cipher An AES cipher context used to encrypt IV to IV'.
Definition at line 217 of file gcryptSrtpSymCrypto.cpp.
void SrtpSymCrypto::f8_encrypt
(
const uint8_t *
data,
uint32_t
dataLen,
uint8_t *
out,
uint8_t *
iv,
)
AES F8 mode encryption.
This method performs the AES F8 encryption, see chapter 4.1.2 in RFC 3711.
- Parameters
-
data Pointer to input and output block, must be dataLen bytes.
dataLen Number of bytes to process.
out Pointer to output buffer, must be dataLen bytes.
iv The initialization vector as input to create the cipher stream. Refer to chapter 4.1.1 in RFC 3711.
f8Cipher An AES cipher context used to encrypt IV to IV'.
Definition at line 260 of file gcryptSrtpSymCrypto.cpp.
void SrtpSymCrypto::get_ctr_cipher_stream
(
uint8_t *
output,
uint32_t
length,
uint8_t *
iv
)
Computes the cipher stream for AES CM mode.
- Parameters
-
output Pointer to a buffer that receives the cipher stream. Must be at least length bytes long.
length Number of cipher stream bytes to produce. Usually the same length as the data to be encrypted.
iv The initialization vector as input to create the cipher stream. Refer to chapter 4.1.1 in RFC 3711.
Definition at line 128 of file gcryptSrtpSymCrypto.cpp.
const uint8_t *
in,
int32_t
length,
uint8_t *
out
)
private
bool SrtpSymCrypto::setNewKey
(
const uint8_t *
key,
int32_t
keyLength
)
Set new key.
- Parameters
-
key Pointer to key data, must have at least a size of keyLength
keyLength Length of the key in bytes, must be 16, 24, or 32
- Returns
- false if key could not set.
Definition at line 74 of file gcryptSrtpSymCrypto.cpp.
Field Documentation
int32_t SrtpSymCrypto::algorithm
private
void* SrtpSymCrypto::key
private
The documentation for this class was generated from the following files: