xcloud-python icon indicating copy to clipboard operation
xcloud-python copied to clipboard

SRTP Stream

Open tuxuser opened this issue 5 years ago • 2 comments

Research low level streaming protocol aka Nanov3.

Is it using this?

GET /v4/sessions/home/12D89B40-ACB6-4E1B-8E96-F744E8D05D73/configuration HTTP/1.1

{
    "keepAlivePulseInSeconds": 300,
    "serverDetails": {
        "ipAddress": "10.0.0.174",
        "port": 9002,
        "ipV4Address": "10.0.0.174",
        "ipV4Port": 9002,
        "ipV6Address": null,
        "ipV6Port": 0,
        "iceExchangePath": "v4/sessions/home/12D89B40-ACB6-4E1B-8E96-F744E8D05D73/ice",
        "stunServerAddress": null,
        "srtp": {
            "key": "iq+1DPPH/H+4k/n4wERjqXr4OXYXrwqcDiitbHkz"
        }
    }
}

Or does it use the srtp.key above and negotiated connection/port of ICE (see Issue #2 - ICE: Negotiation) ?

UPDATE (2020/03/03)

  • Yes, srtp.key received in this HTTP response is indeed the per-session MASTER KEY
  • This key is transformed into 3 SESSION KEYS

MS-SRTP follows the basic patterns of RFC3711 with minor differences: (https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-srtp/ac253f1b-e9a7-46d2-8508-e6b3c3641a68)

Plan of action

  • [X] Research master/session key derivation
  • [x] Implement (MS-)SRTP patterns according to RFC3711
    • [ ] Find out if there is a library that already provides the required SRTP patterns
    • [x] Research how Nonce for AES-GCM cryptographical context is transformed (from session key 3)

References

MS-SRTP: Secure Real-time Transport Protocol (SRTP) Profile

RFC3711

tuxuser avatar Sep 29 '20 22:09 tuxuser

Connecting with reconnect srtp key, This={}. Creating nano stream with args videoConfig.WidthInPixels={}, videoConfig.HeightInPixels={}, videoConfig.MaxStreamCaptureSizeInBytes={}, audioConfig.SampleRateInHz={}, audioConfig.BufferSizeInFrames={}, audioConfig.EnableMicrophone={} Connecting to session at {}:{}, with SRTP key ={}, This={}. MicroManager::DisconnectAsync; Reason={}, This={}. xCloud.Client.SDK.MicroManager.DisconnectAsync

Probably stream use srtp.key above.

akahmet avatar Feb 16 '21 19:02 akahmet

There is pysrtp but it looks unmaintained and just provides the very basic data-level implementation.

Something like aiortc would be better...

Desired features:

  • SRTP Crypto according to RFC3711 / MS-SRTP (AES-GCM128)
  • ?

tuxuser avatar Mar 04 '21 08:03 tuxuser