/** * Writes the SessionID of the SSL2ServerHello into the final byte[] */ private void writeSessionID(SSL2ServerHelloMessage message) { appendBytes(message.getSessionId().getValue()); LOGGER.debug("SessionID: " + ArrayConverter.bytesToHexString(message.getSessionId().getValue())); }
/** * Reads the next bytes as the SessionID and writes them in the message * * @param message * Message to write in */ private void parseSessionID(SSL2ServerHelloMessage message) { message.setSessionID(parseByteArrayField(message.getSessionIdLength().getValue())); LOGGER.debug("SessionID: " + ArrayConverter.bytesToHexString(message.getSessionId().getValue())); } }
if (getSessionId() != null && getSessionId().getValue() != null) { sb.append(ArrayConverter.bytesToHexString(getSessionId().getValue())); } else { sb.append("null");
@Override public void adjustTLSContext(SSL2ServerHelloMessage message) { byte[] serverRandom = message.getSessionId().getValue(); if (serverRandom != null) { tlsContext.setServerRandom(serverRandom); } Certificate cert = parseCertificate(message.getCertificateLength().getValue(), message.getCertificate() .getValue()); LOGGER.debug("Setting ServerCertificate in Context"); tlsContext.setServerCertificate(cert); if (cert == null || !CertificateUtils.hasRSAParameters(cert)) { LOGGER.error("Cannot parse Certificate from SSL2ServerHello"); } else { LOGGER.debug("Adjusting RSA PublicKey"); try { tlsContext.setServerRSAPublicKey(CertificateUtils.extractRSAPublicKey(cert)); tlsContext.setServerRsaModulus(CertificateUtils.extractRSAModulus(cert)); } catch (IOException e) { throw new AdjustmentException("Could not adjust PublicKey Information from Certificate", e); } } } }