48
48
* Achim Kraus (Bosch Software Innovations GmbH) - add handshake parameter available to
49
49
* process reordered handshake messages
50
50
* Achim Kraus (Bosch Software Innovations GmbH) - add dtls flight number
51
+ * Achim Kraus (Bosch Software Innovations GmbH) - add preSharedKeyIdentity to
52
+ * support creating statistics.
51
53
******************************************************************************/
52
54
package org .eclipse .californium .scandium .dtls ;
53
55
@@ -146,6 +148,8 @@ public class ServerHandshaker extends Handshaker {
146
148
/** Used to retrieve pre-shared-key from a given client identity */
147
149
protected final PskStore pskStore ;
148
150
151
+ private String preSharedKeyIdentity ;
152
+
149
153
// Constructors ///////////////////////////////////////////////////
150
154
151
155
/**
@@ -244,6 +248,9 @@ public ServerHandshaker(int initialMessageSequenceNo, DTLSSession session, Recor
244
248
245
249
// Methods ////////////////////////////////////////////////////////
246
250
251
+ public String getPreSharedKeyIdentity () {
252
+ return preSharedKeyIdentity ;
253
+ }
247
254
248
255
@ Override
249
256
protected synchronized void doProcessMessage (DTLSMessage message ) throws HandshakeException , GeneralSecurityException {
@@ -712,6 +719,7 @@ private byte[] receivedClientKeyExchange(final PSKClientKeyExchange message) thr
712
719
713
720
// use the client's PSK identity to look up the pre-shared key
714
721
String identity = message .getIdentity ();
722
+ preSharedKeyIdentity = identity ;
715
723
byte [] psk = pskStore .getKey (indicatedServerNames , identity );
716
724
return configurePskCredentials (identity , psk , null );
717
725
}
@@ -722,6 +730,7 @@ private byte[] receivedClientKeyExchange(final EcdhPskClientKeyExchange message)
722
730
723
731
// use the client's PSK identity to look up the pre-shared key
724
732
String identity = message .getIdentity ();
733
+ preSharedKeyIdentity = identity ;
725
734
byte [] psk = pskStore .getKey (indicatedServerNames , identity );
726
735
byte [] otherSecret = ecdhe .getSecret (message .getEncodedPoint ()).getEncoded ();
727
736
return configurePskCredentials (identity , psk , otherSecret );
0 commit comments