Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 712955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:54:26+00:00 2026-05-14T04:54:26+00:00

I am developing a SSL client that will do a simple request to a

  • 0

I am developing a SSL client that will do a simple request to a SSL server and wait for the response. The SSL handshake and the writing goes OK but I can’t READ data from the socket. I turned on the debug of java.net.ssl and got the following:

[..] 
main, READ: TLSv1 Change Cipher Spec, length = 1 
[Raw read]: length = 5 0000: 16 03 01 00 20                 .... 
[Raw read]: length = 32 [..] 
main, READ: TLSv1 Handshake, length = 32 Padded plaintext after DECRYPTION:  len = 32 
[..]
    *** Finished verify_data:  { 29, 1, 139, 226, 25, 1, 96, 254, 176, 51, 206, 35 }
    *** %% Didn't cache non-resumable client session: [Session-1, SSL_RSA_WITH_RC4_128_MD5] [read] MD5 and SHA1 hashes:  len = 16 0000: 14 00 00 0C 1D 01 8B E2   19 01 60 FE B0 33 CE 23  ..........`..3.# Padded plaintext before ENCRYPTION:  len = 70 [..]                               a.j.y. 
main, WRITE: TLSv1 Application Data, length = 70 
[Raw write]: length = 75 
[..] 
Padded plaintext before ENCRYPTION:  len = 70 
[..] 
main, WRITE: TLSv1 Application Data, length = 70 
[Raw write]: length = 75 
[..] 
main, received EOFException: ignored main, called closeInternal(false) main, SEND TLSv1 ALERT:  warning, description = close_notify Padded plaintext before ENCRYPTION:  len = 18 [..] 
ain, WRITE: TLSv1 Alert, length = 18 [Raw write]: length = 23 
[..] main, called close() 
main, called closeInternal(true) 
main, called close() 
main, called closeInternal(true)

The [..] are the certificate chain.

Here is a code snippet:

try {
            System.setProperty("javax.net.debug","all");
            /*
             * Set up a key manager for client authentication
             * if asked by the server.  Use the implementation's
             * default TrustStore and secureRandom routines.
             */
            SSLSocketFactory factory = null;
            try {
            SSLContext ctx;
            KeyManagerFactory kmf;
            KeyStore ks;
            char[] passphrase = "importkey".toCharArray();

            ctx = SSLContext.getInstance("TLS");
            kmf = KeyManagerFactory.getInstance("SunX509");
            ks = KeyStore.getInstance("JKS");

            ks.load(new FileInputStream("keystore.jks"), passphrase);

            kmf.init(ks, passphrase);
            ctx.init(kmf.getKeyManagers(), null, null);

            factory = ctx.getSocketFactory();
            } catch (Exception e) {
                throw new IOException(e.getMessage());
            }

            SSLSocket socket = (SSLSocket)factory.createSocket("server ip", 9999);

            /*
             * send http request
             *
             * See SSLSocketClient.java for more information about why
             * there is a forced handshake here when using PrintWriters.
             */
            SSLSession session = socket.getSession();

            [build query]

            byte[] buff = query.toWire();

            out.write(buff);
            out.flush();

            InputStream input = socket.getInputStream();

            int readBytes = -1;
            int randomLength = 1024;
            byte[] buffer  = new byte[randomLength];
            while((readBytes = input.read(buffer, 0, randomLength)) != -1) {
                LOG.debug("Read: " + new String(buffer));
            }
            input.close();
            socket.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

I can write multiple times and I don’t get any error but the EOFException happens on the first read.

Am I doing something wrong with the socket or with the SSL authentication?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:54:26+00:00Added an answer on May 14, 2026 at 4:54 am

    The problem was with the packet I was sending. The server was getting the packet, checking that it was badly formatted and dropping the connection. Fixing the packet format fixed the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a client/server app that will communicate via rest. Some custom request data
I am developing a client server app that uses ssl (openssl) to establish a
I'm developing a website that uses SSL (connction to https) and I want to
I am currently developing a site using SSL that requires users to be able
I'm developing a product that needs to act as a server over a local
I'm developing a php site using CURL,but it only works on my local server
I am developing a WCF service, which uses SSL certificate for transport security. I
Iam developing one application.In that iam placing the radio buttons(uiimageview) on table view and
While developing an application using gwt in ecliplse crashed. Now the server is running
Application I am developing does some kind of server-side authorization. Communication is done via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.