Skip to content

Fix key agreement#46

Open
ENeMy235 wants to merge 7 commits intoGurux:masterfrom
ENeMy235:fix-key-agreement
Open

Fix key agreement#46
ENeMy235 wants to merge 7 commits intoGurux:masterfrom
ENeMy235:fix-key-agreement

Conversation

@ENeMy235
Copy link
Copy Markdown

@ENeMy235 ENeMy235 commented Apr 9, 2026

Hi,
after your latest update (https://www.gurux.fi/comment/30893) I realised, that the implementation is still missing some key components.

I did more implementation, to fully support key agreement:

  • fixed KDF fuction to work with 256/384 (verified with comparison with bouncy castle implementaiton)
  • added method for KDF to select correct parameters based on security suite
  • fixed signature creation and validation, based on the signature size
  • added finalizeKeyAgreement method into security setup, to corectly finish key agreement steps after response is recieved (for client side)
  • added support for multiple key agreements in one message (Ephemeral Keys are saved into map and map is cleared when agreement is finalized. Ephemeral keys are generated in the key agreement method)
  • improved server code "invokeKeyAgreement" to work correctly with 256/384 implementation and allow for multiple keys to agree on in one pass.
  • correct key size is get from securitySuite value in the object itself (so invoking keyagreement probably needs user to read the object before invoking method). Also client and server system title for the KDF is using the value in the security setup.

I verified the implementation of the keyagreement only for the client side when comunicating with real meter.

What needs to be verified is the server implementation. And there is missing step in the server implementation, to update keys in the settings (but only if this security setup is the one used for current connection and it needs to update the keys after response is sent).

I hope this will help and you will be able to accept most of the changes. Most of the changes and new methods are compatible with the rest of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant