@@ -20,6 +20,7 @@ but naming changed.**
2020Planned milestones and features:
2121
2222- [x] OCPP 1.6
23+ - [x] OCPP 1.6 Security extension (experimental)
2324- [x] OCPP 2.0.1 (examples working, but will need more real-world testing)
2425- [ ] Dedicated package for configuration management
2526
@@ -346,6 +347,102 @@ Then run the following:
346347docker-compose -f example/1.6/docker-compose.tls.yml up charge-point
347348```
348349
350+ ## OCPP 1.6 Security extension
351+
352+ The library supports the OCPP 1.6 Security extension, which adds support for additional messages that aren't a part of
353+ original OCPP 1.6 specification. The security extension is optional, but recommended to implement.
354+
355+ There aren't any clear examples how to determine if a charge point supports security extensions via ` SupportedProfiles `
356+ configuration key or which profiles are required to be implemented in order to support the security extension.
357+ As of now, the security extension is split into multiple profiles/functional blocks:
358+
359+ - ` ExtendedTriggerMessage `
360+ - ` Certificates ` (certificate management)
361+ - ` Security ` (event notifications, certificate signing)
362+ - ` SecureFirmware ` (secure firmware update)
363+ - ` Logging `
364+
365+ ### HTTP Basic Auth
366+
367+ The security extension specifies how to secure the communication between charge points and central systems
368+ using HTTP Basic Auth and/or certificates. These are already provided in the websocket server/client
369+ implementation.
370+
371+ Example charge point:
372+
373+ ``` go
374+ wsClient := ws.NewClient ()
375+ wsClient.SetBasicAuth (" foo" , " bar" )
376+ cp := ocpp16.NewChargePoint (chargePointID, nil , wsClient)
377+ ```
378+
379+ Example central system:
380+
381+ ``` go
382+ server := ws.NewServer ()
383+ server.SetBasicAuthHandler (func (username string , password string ) bool {
384+ // todo Handle basic auth
385+ return true
386+ })
387+ cs := ocpp16.NewCentralSystem (nil , server)
388+ ```
389+
390+ ### Certificate-based authentication (mTLS)
391+
392+ The security extension specifies how to secure the communication between charge points and central systems
393+ using mTLS (client certificates). The library provides the necessary functionality to configure TLS,
394+ but mTLS itself is not in scope and should be handled by the user.
395+
396+ ### Additional configuration keys
397+
398+ The OCPP 1.6 security extension introduces additional configuration keys.
399+ These are not a part of the standard library, but they impact how the charge point should behave.
400+
401+ The charge point websocket client should be restarted when the ` AuthorizationKey ` configuration changes.
402+
403+ ### Central System
404+
405+ To add support for security extension in the central system, you have the following handlers:
406+
407+ ``` go
408+ // Support callbacks for all OCPP 1.6 profiles
409+ handler := &CentralSystemHandler{chargePoints: map [string ]*ChargePointState{}}
410+ centralSystem.SetCoreHandler (handler)
411+ centralSystem.SetLocalAuthListHandler (handler)
412+ centralSystem.SetFirmwareManagementHandler (handler)
413+ centralSystem.SetReservationHandler (handler)
414+ centralSystem.SetRemoteTriggerHandler (handler)
415+ centralSystem.SetSmartChargingHandler (handler)
416+
417+ // Add callbacks for OCPP 1.6 security profiles
418+ centralSystem.SetSecurityHandler (handler)
419+ centralSystem.SetSecureFirmwareHandler (handler)
420+ centralSystem.SetLogHandler (handler)
421+
422+ ```
423+
424+ ### Charge Point
425+
426+ To add support for security extension in the charge point, you have the following handlers:
427+
428+ ``` go
429+ handler := &ChargePointHandler{}
430+ // Support callbacks for all OCPP 1.6 profiles
431+ chargePoint.SetCoreHandler (handler)
432+ chargePoint.SetFirmwareManagementHandler (handler)
433+ chargePoint.SetLocalAuthListHandler (handler)
434+ chargePoint.SetReservationHandler (handler)
435+ chargePoint.SetRemoteTriggerHandler (handler)
436+ chargePoint.SetSmartChargingHandler (handler)
437+ // OCPP 1.6j Security extension
438+ chargePoint.SetCertificateHandler (handler)
439+ chargePoint.SetLogHandler (handler)
440+ chargePoint.SetSecureFirmwareHandler (handler)
441+ chargePoint.SetExtendedTriggerMessageHandler (handler)
442+ chargePoint.SetSecurityHandler (handler)
443+
444+ ```
445+
349446## Advanced Features
350447
351448The library offers several advanced features, especially at websocket and ocpp-j level.
0 commit comments