Java SSL Client/Server random values -


i need access ssl server/client randoms exchanged during ssl/tls handshake can use them @ later time in encapsulated protocol.

how access these values in java? i've had @ sslsocket.gethandshake() doesn't seem expose values.

there's no api call in jsse let access directly.

you can see through -djavax.net.debug=ssl ("client nonce"), that's not accessible within application.

you via reflection on private members, this bad idea (like use of reflection using private members on private api). going dependent on version , implementation of java you're using too.

    field handshakerfield = sslsocket.getclass().getdeclaredfield(             "handshaker");     handshakerfield.setaccessible(true);     object handshakerobj = handshakerfield.get(sslsocket);     system.out.println(handshakerobj);      // start handshake *after* you've got hold of handshaker object,     // otherwise null.     sslsocket.starthandshake();      class<?> handshakerclass = class.forname("sun.security.ssl.handshaker");     field clientrandomfield = handshakerclass             .getdeclaredfield("clnt_random");     clientrandomfield.setaccessible(true);     object clientrandomobj = clientrandomfield.get(handshakerobj);     system.out.println(clientrandomobj);      field randombytesfield = clientrandomobj.getclass().getdeclaredfield(             "random_bytes");     randombytesfield.setaccessible(true);     byte[] randombytesobj = (byte[])randombytesfield.get(clientrandomobj); 

i'm not sure why encapsulated protocol need this. doesn't seem idea @ all. it's not clear kind of security meant add. if you're after ssl/tls channel token of sorts, using session id better (although that's not idea either).

it's quite ssl/tls stacks not let hold of in general. it's main purpose generate pre_master_secret , "the pre_master_secret should deleted memory once master_secret has been computed." (according tls specification).


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -