-
Notifications
You must be signed in to change notification settings - Fork 367
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
Pass Handshaker instance to handshakeFailed & handshakeCompleted in SessionListener #744
Comments
FMPOV, it makes sense. I try to include it in 2.0.0-M12. |
Looks like there is another challenge for my use case of logging the invalid PSK attempts to a database. The SessionListener interface's I wonder what would be the way to proceed. Could I add another issue as a feature request for having some listener method called when the PSK is invalid? |
This make senses to me to call |
Even if calling My actual use case is to be able to detect when the PSK secret is incorrect. For that I'm expecting that the original approach using the handshakeFailed event + DTLSSession.getPeerIdentity would be a working solution. |
Please remind, that PR #605 introduced the "discard" instead of "terminate". And in issue #606 there is still a discussion about the best practice there. I'm not sure, if calling |
It seems to me that "discard or terminate" is about behavior expose to foreign peer. Creating a specific HanshakeException (like UnknowPskException with necessary getter) could be a way. |
ASFAIK: "discard": simply ignores the record (but potentially leave the session/handshake in a unexpected state) "terminate": remove connection and session, call handshakeFailed, and send alerts to the other peer. "handshakeFailed": call all handler, and execute, what they do. At least the Connection handler will modify the connection and with that, the further processing is changed. FMPOV, it seems to be too complex for too easy answers. |
I'm linking one more issue to this discussion, #343 . It's slightly related to the |
After reanalyzing, I think a solution would be to add the PreSharedKey identity to the |
If you want to use |
Alternatively, the already available |
It's merged. If possible, give us please a feedback, if it works for you. |
Thanks @boaks . The change LGTM. Do you also publish snapshot releases to some repository? That would make my testing a bit easier. |
The build has completed and the result should be in https://repo.eclipse.org/content/repositories/californium-snapshots |
@boaks Thank you. I tested with 2.0.0-SNAPSHOT. I can confirm that these changes work for me. |
Great news! So, please close this issue. I hope we can release 2.0.0-M12 this week. |
I'm looking forward to that. Thanks for your help @boaks |
Just to mention: |
My use case is about doing custom logging to a database when a DTLS handshake fails. The requirement is to be able to associate the handshake failures to a PSK identity.
The PSK identity wrapped in a
PreSharedKeyIdentity
instance is set to DTLSSession.setPeerIdentity.I'd like to look this up when the handshake fails.
The current challenge is the
SessionListener
interface. (Thanks for previous changes related to #716 which made it possible to register customSessionListener
s). ThehandshakeFailed
method doesn't pass theHandshaker
instance to thehandshakeFailed
method call. If it was passed, I'd expect it would be possible to find the PSK identity by calling((PreSharedKeyIdentity)handshaker.getSession().getPeerIdentity()).getIdentity()
.requested change in SessionListener interface:
The current
handshakeStarted
andsessionEstablished
methods already have theHandshaker handshaker
parameter so this change would also improve the consistency of theSessionListener
interface.The text was updated successfully, but these errors were encountered: