bcoSslSocket = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream(), secureRandom); bcoSslSocket.connect(new DefaultTlsClient() { @Override public TlsAuthentication getAuthentication() throws IOException { InputStream sis = bcoSslSocket.getInputStream(); source.setInputStream(sis); OutputStream sos = bcoSslSocket.getOutputStream(); sink.setOutputStream(sos);
Socket socket = new Socket(<server IP>, SERVER_PORT); TlsClientProtocol tlsClientProtocol = new TlsClientProtocol( socket.getInputStream(), socket.getOutputStream()); tlsClientProtocol.connect(new DefaultTlsClient() { public TlsAuthentication getAuthentication() throws IOException { return new ServerOnlyTlsAuthentication() { public void notifyServerCertificate(Certificate serverCertificate) throws IOException { validateCertificate(serverCertificate); } }; } }); String message = new BufferedReader( new InputStreamReader(tlsClientProtocol.getInputStream())).readLine();
processFinishedMessage(buf); this.connection_state = CS_SERVER_FINISHED; sendChangeCipherSpecMessage(); sendFinishedMessage(); this.connection_state = CS_CLIENT_FINISHED; completeHandshake(); return; handleSupplementalData(null); assertEmpty(buf); assertEmpty(buf); processFinishedMessage(buf); this.connection_state = CS_SERVER_FINISHED; completeHandshake(); break; receiveServerHelloMessage(buf); this.connection_state = CS_SERVER_HELLO; applyMaxFragmentLengthExtension(); this.recordStream.setPendingConnectionState(getPeer().getCompression(), getPeer().getCipher());
processFinishedMessage(buf); this.connection_state = CS_SERVER_FINISHED; sendFinishedMessage(); this.connection_state = CS_CLIENT_FINISHED; this.connection_state = CS_END; handleSupplementalData(null); assertEmpty(buf); assertEmpty(buf); processFinishedMessage(buf); this.connection_state = CS_SERVER_FINISHED; this.connection_state = CS_END; receiveServerHelloMessage(buf); this.connection_state = CS_SERVER_HELLO; this.securityParameters.prfAlgorithm = getPRFAlgorithm(getContext(), this.securityParameters.getCipherSuite()); this.recordStream.setPendingConnectionState(getPeer().getCompression(), getPeer().getCipher()); sendChangeCipherSpecMessage(); invalidateSession();
ProtocolVersion client_version = getContext().getClientVersion(); if (!server_version.isEqualOrEarlierVersionOf(client_version)) getContextAdmin().setServerVersion(server_version); this.tlsClient.notifyServerVersion(server_version); || selectedCipherSuite == CipherSuite.TLS_NULL_WITH_NULL_NULL || CipherSuite.isSCSV(selectedCipherSuite) || !TlsUtils.isValidCipherSuiteForVersion(selectedCipherSuite, getContext().getServerVersion())) this.serverExtensions = readExtensions(buf); if (!Arrays.constantTimeAreEqual(renegExtData, createRenegotiationInfo(TlsUtils.EMPTY_BYTES))) this.securityParameters.maxFragmentLength = processMaxFragmentLengthExtension(sessionClientExtensions, sessionServerExtensions, AlertDescription.illegal_parameter); this.securityParameters.prfAlgorithm = getPRFAlgorithm(getContext(), this.securityParameters.getCipherSuite());
this.securityParameters.clientRandom = createRandomBlock(tlsClient.shouldUseGMTUnixTime(), tlsClientContext.getNonceRandomGenerator()); sendClientHelloMessage(); this.connection_state = CS_CLIENT_HELLO; completeHandshake();
this.securityParameters.clientRandom = createRandomBlock(tlsClient.shouldUseGMTUnixTime(), tlsClientContext.getNonceRandomGenerator()); sendClientHelloMessage(); this.connection_state = CS_CLIENT_HELLO; blockForHandshake();
getContextAdmin().setClientVersion(client_version); writeExtensions(message, clientExtensions);
protected void receiveNewSessionTicketMessage(ByteArrayInputStream buf) throws IOException { NewSessionTicket newSessionTicket = NewSessionTicket.parse(buf); assertEmpty(buf); tlsClient.notifyNewSessionTicket(newSessionTicket); }
protected void handleSupplementalData(Vector serverSupplementalData) throws IOException { this.tlsClient.processServerSupplementalData(serverSupplementalData); this.connection_state = CS_SERVER_SUPPLEMENTAL_DATA; this.keyExchange = tlsClient.getKeyExchange(); this.keyExchange.init(getContext()); }
final TlsClientProtocol tlsClientProtocol = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream(), new SecureRandom());
ProtocolVersion client_version = getContext().getClientVersion(); if (!server_version.isEqualOrEarlierVersionOf(client_version)) getContextAdmin().setServerVersion(server_version); this.tlsClient.notifyServerVersion(server_version); this.serverExtensions = readExtensions(buf); if (!Arrays.constantTimeAreEqual(renegExtData, createRenegotiationInfo(TlsUtils.EMPTY_BYTES))) this.securityParameters.maxFragmentLength = processMaxFragmentLengthExtension(sessionClientExtensions, sessionServerExtensions, AlertDescription.illegal_parameter);
getContextAdmin().setClientVersion(client_version); writeExtensions(message, clientExtensions);
protected void receiveNewSessionTicketMessage(ByteArrayInputStream buf) throws IOException { NewSessionTicket newSessionTicket = NewSessionTicket.parse(buf); assertEmpty(buf); tlsClient.notifyNewSessionTicket(newSessionTicket); }
protected void handleSupplementalData(Vector serverSupplementalData) throws IOException { this.tlsClient.processServerSupplementalData(serverSupplementalData); this.connection_state = CS_SERVER_SUPPLEMENTAL_DATA; this.keyExchange = tlsClient.getKeyExchange(); this.keyExchange.init(getContext()); }
final TlsClientProtocol tlsClientProtocol = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream(), _secureRandom); return _createSSLSocket(host, tlsClientProtocol);
java.security.SecureRandom secureRandom = new java.security.SecureRandom(); Socket socket = new Socket(java.net.InetAddress.getByName("www.google.com"), 443); TlsClientProtocol protocol = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream(),secureRandom); DefaultTlsClient client = new DefaultTlsClient() { public TlsAuthentication getAuthentication() throws IOException { protocol.connect(client); java.io.OutputStream output = protocol.getOutputStream(); output.write("GET / HTTP/1.1\r\n".getBytes("UTF-8")); output.write("Host: www.google.com\r\n".getBytes("UTF-8")); output.flush(); java.io.InputStream input = protocol.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(input)); String line;
java.security.SecureRandom secureRandom = new java.security.SecureRandom(); Socket socket = new Socket(java.net.InetAddress.getByName("www.google.com"), 443); TlsClientProtocol protocol = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream(),secureRandom); DefaultTlsClient client = new DefaultTlsClient() { public TlsAuthentication getAuthentication() throws IOException { protocol.connect(client); java.io.OutputStream output = protocol.getOutputStream(); output.write("GET / HTTP/1.1\r\n".getBytes("UTF-8")); output.write("Host: www.google.com\r\n".getBytes("UTF-8")); output.flush(); java.io.InputStream input = protocol.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(input)); String line;