matth-x / MicroOcpp

OCPP 1.6 / 2.0.1 client for microcontrollers
MIT License
344 stars 149 forks source link

Add web socket authentication and TLS certificate on OCPP_initialize #126

Closed pedro-fuoco closed 1 year ago

pedro-fuoco commented 1 year ago

Hi! My application uses web socket authentication when connecting with the Central System, I imagine this is a common security measure in EV chargers. I was thinking about making a pull request to add "login" and "password" optional arguments to OCPP_initialize, what do you think? @matth-x

pedro-fuoco commented 1 year ago

Defaulting to SSL might be worth it as well. We can add the fingerprint as an optional argument and just send an empty string if not used.

matth-x commented 1 year ago

Hi Pedro,

If I'm honest, I never really liked the initialize function myself. Very happy to accept improvements.

To provide the community with the best code, it should be aligned to the most practical requirements. The WebSocket authentication header is a very common practice in OCPP. Fingerprints are wide spread in IoT controllers, but with OCPP I've only seen TLS certificates so far. So is it an option for you to provide a certificate-based initialize function?

I also like the idea to engage people to move from WS to WSS much quicker. It would be a huge improvement to combine both in the same initialize function. Do you think it's possible enable / disable TLS based on the URL?

pedro-fuoco commented 1 year ago

The WebSocket authentication header is a very common practice in OCPP

That's great to hear!

is it an option for you to provide a certificate-based initialize function?

Yeah, sure! I'll look into it

Do you think it's possible enable / disable TLS based on the URL?

Loved the idea, it will highly improve the function's versatility. I will be back later today with these upgrades, let me know if other ideas arise

pedro-fuoco commented 1 year ago

I've commited the updated version to the pull request #127 @matth-x