-
-
Notifications
You must be signed in to change notification settings - Fork 443
Implement OCPP 1.6 Security #1854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
juherr
wants to merge
53
commits into
steve-community:master
Choose a base branch
from
juherr:feature/ocpp16-security
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
81ba853
feat: implement OCPP 1.6 Security
florinmandache b753424
Merge branch steve-community/steve 'master' into feature/ocpp16-security
goekay b021b4f
fix: build error because of db migration with same version exists
goekay ca48906
use data models from ocpp-jaxb dependency
goekay ad62b97
fix builds
goekay eb13078
refactor
goekay 3878731
refactor: move password validation to ChargePointService
goekay 59c1c8d
refactor DB changes
goekay a47ed12
make project compile
goekay 9ad638a
implement LogStatusNotification
goekay cb36fe7
implement SignedFirmwareStatusNotification
goekay d84e47c
implement ExtendedTriggerMessage
goekay 0cfb615
implement GetLog
goekay b305cb5
implement SignedUpdateFirmware
goekay ca26cc4
refactor ocpp 1.6 left menu
goekay 7dd51f5
revisit and refine the impl for security events page
goekay a6440e1
rename "security" dir to "security-man" to represent security management
goekay 47d455d
work on SignCertificate
goekay 2f214d3
add support for new Configuration Keys
goekay 1331528
implement InstallCertificate
goekay 5c29fae
revisit and refine the impl for "firmware updates" page(s)
goekay 76a5698
generalize "firmware update" into "status event" pages
goekay d75ca6b
nits
goekay b3fa5f8
refactor/cleanup: remove unnecessary SecurityRepository methods
goekay f6da094
implement CertificateSigned and revise CertificateSigningServiceLocal
goekay c23d84c
refactor and nits
goekay 9c92479
merge SecurityProfileConfiguration into org.springframework.boot.web.…
goekay 14c0cf9
refactor and nits
goekay 256445e
implement GetInstalledCertificateIds
goekay 96f4d14
implement DeleteCertificate
goekay abb7ee9
implement and refactor certificates pages
goekay 45aab67
implement page for "signed certificates"
goekay 30270ba
refactor: split SecurityRepository into CertificateRepository and Eve…
goekay bb6c4a2
build fix, refactor and cleanup
goekay 2f5722c
add CRUD functionality for new station fields: security profile and a…
goekay f766840
refactor
goekay d3cfba4
add temporal filtering to certificate and event pages
goekay 0261550
refactor: move columns for consistency
goekay 9f3a7fe
nits [skip ci]
goekay c8032fd
add authPassword validation for profiles 1 and 2 in ChargePointForm
goekay 976d208
implement basic auth validation during websocket handshake
goekay 2a5f8b0
nits
goekay a4e730f
add info boxes
goekay 2f2f5a9
nits
goekay d8e0147
nits for mTLS
goekay 2bdb892
refactor: we can access Ssl in ServerProperties (which is a bean)
goekay 7ea8a11
work on markdown docs
goekay 31cb162
refactor: PR feedback
goekay d8c089e
push isJson() check down to ChargePointServiceJsonInvoker
goekay 5940aea
nits
goekay 2919fda
get CpoName and update in DB eagerly after each ws connection
goekay 4c64664
implement ocpp-related field checks as client cert validation
goekay 3716f68
make job_id nullable (i.e. requestId optional in notification messages)
goekay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/de/rwth/idsg/steve/ocpp/OcppSecurityProfile.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| * SteVe - SteckdosenVerwaltung - https://github.com/steve-community/steve | ||
| * Copyright (C) 2013-2025 SteVe Community Team | ||
| * All Rights Reserved. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
| package de.rwth.idsg.steve.ocpp; | ||
|
|
||
| import lombok.Getter; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| /** | ||
| * @author Sevket Goekay <[email protected]> | ||
| * @since 10.11.2025 | ||
| */ | ||
| @RequiredArgsConstructor | ||
| @Getter | ||
| public enum OcppSecurityProfile { | ||
| Profile_0(0, "0: No HTTP basic authentication, no TLS"), | ||
| Profile_1(1, "1: HTTP basic authentication, no TLS"), | ||
| Profile_2(2, "2: HTTP basic authentication, TLS with server-side certificate"), | ||
| Profile_3(3, "3: TLS with client-side and server-side certificates (mutual TLS or mTLS)"); | ||
|
|
||
| private final int value; | ||
| private final String description; | ||
|
|
||
| public static OcppSecurityProfile fromValue(Integer value) { | ||
| if (value == null) { | ||
| return null; | ||
| } | ||
| for (OcppSecurityProfile c: OcppSecurityProfile.values()) { | ||
| if (c.getValue() == value) { | ||
| return c; | ||
| } | ||
| } | ||
| throw new IllegalArgumentException(String.valueOf(value)); | ||
| } | ||
|
|
||
| public boolean requiresBasicAuth() { | ||
| return switch (this) { | ||
| case Profile_1, Profile_2 -> true; | ||
| default -> false; | ||
| }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/main/java/de/rwth/idsg/steve/ocpp/task/CertificateSignedTask.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /* | ||
| * SteVe - SteckdosenVerwaltung - https://github.com/steve-community/steve | ||
| * Copyright (C) 2013-2025 SteVe Community Team | ||
| * All Rights Reserved. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
| package de.rwth.idsg.steve.ocpp.task; | ||
|
|
||
| import de.rwth.idsg.steve.ocpp.Ocpp16AndAboveTask; | ||
| import de.rwth.idsg.steve.ocpp.OcppCallback; | ||
| import de.rwth.idsg.steve.repository.CertificateRepository; | ||
| import de.rwth.idsg.steve.web.dto.ocpp.CertificateSignedParams; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import ocpp._2022._02.security.CertificateSigned; | ||
| import ocpp._2022._02.security.CertificateSignedResponse; | ||
| import ocpp._2022._02.security.CertificateSignedResponse.CertificateSignedStatusEnumType; | ||
|
|
||
| import jakarta.xml.ws.AsyncHandler; | ||
|
|
||
| @Slf4j | ||
| public class CertificateSignedTask extends Ocpp16AndAboveTask<CertificateSignedParams, String> { | ||
|
|
||
| private final CertificateRepository certificateRepository; | ||
|
|
||
| public CertificateSignedTask(CertificateSignedParams params, | ||
| CertificateRepository certificateRepository) { | ||
| super(params); | ||
| this.certificateRepository = certificateRepository; | ||
| } | ||
|
|
||
| @Override | ||
| public OcppCallback<String> defaultCallback() { | ||
| return new StringOcppCallback(); | ||
| } | ||
|
|
||
| @Override | ||
| public CertificateSigned getOcpp16Request() { | ||
| var request = new CertificateSigned(); | ||
| request.setCertificateChain(params.getCertificateChain()); | ||
| return request; | ||
| } | ||
|
|
||
| @Override | ||
| public AsyncHandler<CertificateSignedResponse> getOcpp16Handler(String chargeBoxId) { | ||
| return res -> { | ||
| try { | ||
| var status = res.get().getStatus(); | ||
| success(chargeBoxId, status.value()); | ||
|
|
||
| switch (status) { | ||
| case ACCEPTED -> log.info("Request was {} by charge point '{}'", status, chargeBoxId); | ||
| case REJECTED -> log.warn("Request was {} by charge point '{}'", status, chargeBoxId); | ||
| default -> log.warn("Unexpected status {} by charge point '{}'", status, chargeBoxId); | ||
| } | ||
|
|
||
| boolean accepted = (status == CertificateSignedStatusEnumType.ACCEPTED); | ||
| certificateRepository.insertCertificateSignResponse(chargeBoxId, params.getCertificateId(), accepted); | ||
| } catch (Exception e) { | ||
| failed(chargeBoxId, e); | ||
| } | ||
| }; | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.