@Nullable private static String initSessionId(SSLSession session) { byte [] bytes = session.getId(); if (bytes == null) { return null; } StringBuilder sb = new StringBuilder(); for (byte b : bytes) { String digit = Integer.toHexString(b); if (digit.length() < 2) { sb.append('0'); } if (digit.length() > 2) { digit = digit.substring(digit.length() - 2); } sb.append(digit); } return sb.toString(); }
@Override public byte[] getSessionId() { return channel.getSslSession().getId(); }
@Nullable private static String initSessionId(SSLSession session) { byte [] bytes = session.getId(); if (bytes == null) { return null; } StringBuilder sb = new StringBuilder(); for (byte b : bytes) { String digit = Integer.toHexString(b); if (digit.length() < 2) { sb.append('0'); } if (digit.length() > 2) { digit = digit.substring(digit.length() - 2); } sb.append(digit); } return sb.toString(); }
@Override public byte[] getSessionId() { return channel.getSslSession().getId(); }
@Nullable private static String initSessionId(SSLSession session) { byte[] bytes = session.getId(); if (bytes == null) { return null; } StringBuilder sb = new StringBuilder(); for (byte b : bytes) { String digit = Integer.toHexString(b); if (digit.length() < 2) { sb.append('0'); } if (digit.length() > 2) { digit = digit.substring(digit.length() - 2); } sb.append(digit); } return sb.toString(); }
public byte[] getId() { return unwrap().getId(); }
private static SSLSession newSslSession() { final SSLSession sslSession = mock(SSLSession.class); when(sslSession.getId()).thenReturn(new byte[] { 1, 1, 2, 3, 5, 8, 13, 21 }); when(sslSession.getProtocol()).thenReturn("TLSv1.2"); when(sslSession.getCipherSuite()).thenReturn("some-cipher"); return sslSession; }
private void exportTlsProperties(Map<String, String> out, RequestContext ctx) { final SSLSession s = ctx.sslSession(); if (s != null) { if (builtIns.contains(TLS_SESSION_ID)) { final byte[] id = s.getId(); if (id != null) { out.put(TLS_SESSION_ID.mdcKey, lowerCasedBase16.encode(id)); } } if (builtIns.contains(TLS_CIPHER)) { final String cs = s.getCipherSuite(); if (cs != null) { out.put(TLS_CIPHER.mdcKey, cs); } } if (builtIns.contains(TLS_PROTO)) { final String p = s.getProtocol(); if (p != null) { out.put(TLS_PROTO.mdcKey, p); } } } }
public String getSessionId() throws IOException { // Look up the current SSLSession /* SJSAS 6439313 SSLSession session = ssl.getSession(); */ if (session == null) return null; // Expose ssl_session (getId) byte [] ssl_session = session.getId(); if ( ssl_session == null) return null; StringBuilder buf=new StringBuilder(""); for(int x=0; x<ssl_session.length; x++) { String digit=Integer.toHexString((int)ssl_session[x]); if (digit.length()<2) buf.append('0'); if (digit.length()>2) digit=digit.substring(digit.length()-2); buf.append(digit); } return buf.toString(); }
log.debug("hostname = {}, session = {}",hostname, Base64.encode(session.getId()));
public byte[] nextElement() { if (hasMoreElements()) { byte[] id = next.getId(); next = null; return id; } throw new NoSuchElementException(); } };
void putSession(SSLSession session) { byte[] id = session.getId(); if (id.length == 0) { return; } ByteArray key = new ByteArray(id); synchronized (sessions) { sessions.put(key, session); } }
public byte[] nextElement() { if (hasMoreElements()) { byte[] id = next.getId(); next = null; return id; } throw new NoSuchElementException(); } };
void putSession(SSLSession session) { byte[] id = session.getId(); if (id.length == 0) { return; } ByteArray key = new ByteArray(id); synchronized (sessions) { sessions.put(key, session); } }
@Override public byte[] getSessionId() { return channel.getSslSession().getId(); }
@Override protected byte[] getSslSessionIdBytes() { Socket socket = getSocket(); if (socket instanceof SSLSocket) { SSLSocket sslSocket = (SSLSocket) socket; SSLSession sslSession = sslSocket.getSession(); if (sslSession != null) { return sslSession.getId(); } } return null; }
@Override public byte[] getSessionId() { return channel.getSslSession().getId(); }
@Override public byte[] getId() { return delegate().getId(); }
@Override public byte[] getSessionId() { return channel.getSslSession().getId(); }
public static String getSocketProtocol(final Socket sock) { if (sock instanceof SSLSocket) { final SSLSocket sslSock = (SSLSocket) sock; final SSLSession session = sslSock.getSession(); final String id = SimpleHex.bytesAsHex(session.getId()); return session.getProtocol() + ":" + session.getCipherSuite() + " ID=" + id; } return ""; } }