Haivision / srt

Secure, Reliable, Transport
https://www.srtalliance.org
Mozilla Public License 2.0
3k stars 825 forks source link

[FR] Authenticated Encryption (AEAD) #2336

Open maxsharabayko opened 2 years ago

maxsharabayko commented 2 years ago

Authenticated-Encryption with Associated-Data (AEAD) schemes provide confidentiality by encrypting the data, and also provide authenticity assurances by creating a MAC tag over the encrypted data. The MAC tag will ensure the data is not accidentally altered or maliciously tampered during transmission and storage [OpenSSL Wiki].

1. Select Supported Algorithms (GCM, CCM, etc.) ✔️

There are a number of AEAD modes of operation. The modes include EAX, CCM, and GCM (RFC 5647).

AEAD parts [OpenSSL Wiki]:

2. Encrypt Data Packets

3. SRT API Changes

4. SRT Handshake Enhancements: Negotiate Encryption

5. Maximum Payload Size

AEAD requires placing an authentication tag along with the payload. In the case of GCM mode, the tag takes 16 bytes (CCM: 14 bytes). Thus maximum payload size has to be handled accordingly. Also, decide if and how should this work with FEC.

6. FEC

Define how FEC and a packet filter, in general, should work with authenticated packets. Just include the whole data packet? Should the FEC packet be authenticated? Probably not, it would also complicate things a lot.

7. Integrate into the CRYSPR

The encryption provider library of SRT has to support AEAD (GCM mode).

8. Error Handling

8. Unit Tests

9. Application-level testing

Test different SRT versions work correctly with each other:

  1. Connection establishment w/o AEAD and valid encryption with one peer of an older SRT version.
  2. Connection rejection in AEAD configuration with one peer of an older SRT version.
  3. etc.

10. Update the IETF SRT Internet Draft.

ethouris commented 2 years ago

Basing on the possible application, there should be also 3 possibilities provided:

  1. Full signature. The whole packet is taken for the signature, the R flag must be set to 0 before checks. The signature cannot be passed through - the SRT re-routing machines would have to authenticate and replace the signature if needed.
  2. Payload passthrough. Only the payload is included, all other fields can be potentially altered, but this can be freely passed through and freely decided on timestamp passthrough.
  3. Timely payload passthrough. Payload and the timestamp are included. This can be freely passed through with the original unchecked signature, but the re-routing application must preserve the original timestamp.