Skip to content

Commit

Permalink
Fixed conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
machinex85 committed Oct 10, 2024
1 parent 804f5f5 commit 5e33565
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions iso15118/shared/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def get_ssl_context(server_side: bool) -> Optional[SSLContext]:
# pymongo setup a client side, but we also need the server side:
# https://github.com/pyca/pyopenssl/blob/main/src/OpenSSL/SSL.py#L1653

if SettingKey.FORCE_TLS_CLIENT_AUTH:
if shared_settings[SettingKey.FORCE_TLS_CLIENT_AUTH]:
# In 15118-20 we should also verify EVCC's certificate chain.
# The spec however says TLS 1.3 should also support 15118-2
# (Table 5 in V2G20 specification)
Expand Down Expand Up @@ -225,7 +225,7 @@ def get_ssl_context(server_side: bool) -> Optional[SSLContext]:
"ECDHE-ECDSA-AES128-SHA256"
)

if SettingKey.FORCE_TLS_CLIENT_AUTH:
if shared_settings[SettingKey.FORCE_TLS_CLIENT_AUTH]:
logger.debug("LOADING CERTIFICATES OEM")
try:
ssl_context.load_cert_chain(
Expand Down Expand Up @@ -259,7 +259,7 @@ def get_ssl_context(server_side: bool) -> Optional[SSLContext]:
# https://docs.python.org/3/library/ssl.html#ssl.create_default_context
# https://docs.python.org/3/library/ssl.html#ssl.SSLContext.keylog_filename
# https://github.com/python/cpython/blob/3.11/Lib/ssl.py#L777
keylogfile = os.path.join(SettingKey.PKI_PATH, "keylogfile.txt")
keylogfile = os.path.join(shared_settings[SettingKey.PKI_PATH], "keylogfile.txt")
if logging.getLogger().level == logging.DEBUG:
if not os.path.exists(keylogfile):
with open(keylogfile, 'w'):
Expand Down
3 changes: 1 addition & 2 deletions iso15118/shared/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SettingKey:
PKI_PATH = "PKI_PATH"
MESSAGE_LOG_JSON = "MESSAGE_LOG_JSON"
MESSAGE_LOG_EXI = "MESSAGE_LOG_EXI"
ENABLE_TLS_1_3 = "ENABLE_TLS_1_3"
FORCE_TLS_CLIENT_AUTH = "FORCE_TLS_CLIENT_AUTH"


shared_settings = {}
Expand All @@ -27,7 +27,6 @@ def load_shared_settings(env_path: Optional[str] = None):
SettingKey.MESSAGE_LOG_JSON: env.bool("MESSAGE_LOG_JSON", default=True),
SettingKey.MESSAGE_LOG_EXI: env.bool("MESSAGE_LOG_EXI", default=False),
SettingKey.FORCE_TLS_CLIENT_AUTH: env.bool("FORCE_TLS_CLIENT_AUTH", default=False),
SettingKey.ENABLE_TLS_1_3: env.bool("ENABLE_TLS_1_3", default=False),
}
shared_settings.update(settings)
env.seal() # raise all errors at once, if any

0 comments on commit 5e33565

Please sign in to comment.