I have a situation in which I wish to produce (physical hardware) widgets that plug into a LAN and act as a web server, serving content to web clients that are also on the LAN.
The traffic from the widgets to the client should be encrypted, but there is the problem that I don't have control of either the LAN or the client, meaning it is impossible to set up a local CA or do any DNS twiddling.
Is it possible to arrange some way in which the widget can serve encrypted data to the web client.
It is probably possible to create and publish certs for every device if that creates some mechanism to allow this to happen (tied to some domain that I own, say widgetN.thedomainiown.com). Assume everything on the LAN can see the big wide internets.
I've considered a couple of strategies as follows:
- Create a cert for each device as above, and ship the widget with that cert installed. I understand this won't work because it will cause a certificate hostname discrepancy.
- Have both the widget and the client communicate over a trusted internet server that I control.
In the second case, at one extreme, all the data can be communicated over the secure links and relayed by the trusted server. I suppose this would solve the problem, however it is impracticable for bandwidth and latency reasons.
Instead, is it possible to use the trusted server to set up the encrypted link between widget and the client? I've thought about using javascript encryption for this, but everything I've read tells me that javascript encryption is simply bad and should never be used. In this instance, I'm not fully clear what the problem would be, so I'd be pleased to be enlightened.
It would be a case of the trusted server constructing a web-app that encapsulates the encryption protocol and the necessary certificates which can then be used to handle the encryption over the LAN. That is, the trusted server provides the web page used to handle the local traffic (is this even possible given the same-origin policy?).