I'm trying to set up a 'view anywhere' telemetry service over a WebRTC RTCDataChannel with on one end a browser and on the other end an embedded system using libdatachannel. The encrypted peer-to-peer part of the session is based on DTLS-SRTP, which means it's established using two self-signed certificates, (seemingly) randomly generated per session. Standard authentication is done by a trusted third party verifying both peers. I would like to instead do mutual authentication for two reasons: 1. To not be dependent on an external server needing to be aware of all service types and 2. to allow multiplexing multiple services which can be negotiated and authenticated on demand.
The fingerprint of the self-signed certificate can be accessed both in the browser and client, giving two unique session IDs for peers
A would create a hash for each [service description (a string / collection of) + it's own session ID] and sends those hashes to peer
B would send a similar hashes generated with it's own ID.
A creates a list of hashes for it's services, but now based on
B's ID and compares this with the hashes received to determine which services should connect.
B does the same.
The service description would be more or less a pre-shared key, but on service level.
Example use-case: An embedded computer / PLC managing a machine (
A). It would offer 3 services: (1) A stream of sensor data, (2) a video feed and (3) an input stream for control commands. Some viewer, peer (
B) would have the proper service descriptors for only (1) and (2), but not (3). Preventing control while allowing viewing. Another peer (
C) would have access to all three.
Is above scheme foolproof enough to ensure neither party is an imposter?