EVerest / libevse-security

Apache License 2.0
7 stars 5 forks source link

Support multiple SECC leafs for each EVSE of a charging station #68

Open AssemblyJohn opened 5 months ago

AssemblyJohn commented 5 months ago

Describe the problem

According to the OCPP2.0.1 specification we have to support multiple SECC leaf certificates for a charging station. At the moment the concept supports having multiple leaf certificates installed, but they are not dedicated to individual EVSEs.

When a CSR is generated, the Common Name (CN) field of the certificate shall be set to the ISO15118SeccId of the EVSE. In case of multiple EVSEs per charging station, this variable is unique for every EVSE. The CN is already an argument of the generate_csr function so this does not need to change.

The get_key_pair function does currently return the most recent certificate that is already valid and the respective key, without differentiating between the EVSE it was issued for.

Describe your solution

Options:

  1. Extend the get_key_pair function by an argument that represents the ISO15118SeccId.
  2. Seperate the get_key_pair function into two different functions: One for CSMS and one for V2G.

The key pair that is returned shall match this id.

Additional context

The trigger of generating the CSR is outside the scope of this library. Libraries like libocpp need to take care of renewing certificates in case they are expired and calling the generate_csr function with the correct arguments