-1

I'm developing a Java application and I need to send a couple strings to the server through a Secure Sockets, i have to use my own certificate generated by a trusted CA

The file certificate is myOwnCRT.crt

Client

        InputStream is = new FileInputStream("app.config.properties");       
        Properties objProperties = new Properties();
        objProperties.load(is);        
        String ipServer = objProperties.getProperty("ip");             
        String portServer = objProperties.getProperty("port");

        SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
        SSLSocket socketSsl = (SSLSocket)factory.createSocket(idServer, Integer.parseInt(portServer));

        BufferedReader in = new BufferedReader(new InputStreamReader());
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socketSsl.getOutputStream()));

Server

//        System.setProperty("javax.net.ssl.trustStore", "myOwnCRT.crt");
//        System.setProperty("javax.net.ssl.keyStorePassword", "pass");
        SSLServerSocketFactory fact = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
        SSLServerSocket socketServidorSsl = (SSLServerSocket)fact.createServerSocket(Integer.parseInt(1099));
        SSLSocket socketSsl = (SSLSocket)socketServidorSsl.accept();

        BufferedReader entrada = new BufferedReader(new InputStreamReader(socketSsl.getInputStream()));

        String line= null;
        System.out.println( "Waiting..." );

        while( (linea = entrada.readLine()) != null ) 
        {
            System.out.println(line);
            System.out.flush();
        }

How i can send to the server two Strings through SSLSockets?

I hope you can help me.

Thanks a lot

user207421
  • 289,834
  • 37
  • 266
  • 440
darthlitox
  • 77
  • 1
  • 10
  • 1
    And the **concrete** question is??? – home Jun 21 '13 at 15:26
  • 3
    Welcome to StackOverflow! Please keep in mind this is a place where the community can help fix your code, not write it for you, which your question borderline asks. Additionally, please make sure your question is stated very clearly in the body of your post. The title is NOT the place for the question! Rather, it is a quick summary of the issue. – Russell Uhl Jun 21 '13 at 15:27
  • @RussellUhl i'm really sorry about this post. I edit the post, how i can open the post again? – darthlitox Jun 25 '13 at 14:09
  • you can't, as far as i know. repost it as a new question, but this time make sure to include ALL of the information in the question. We're not mean people, really :) – Russell Uhl Jun 25 '13 at 14:26

1 Answers1

1

You can start by doing research. Read up on how keytool and jarsigner work, and how to use them. Read up on web encryption standards. If you don't know, research what a certificate and CSR is. Research how to properly set up an authentication system with a backend database which stores encrypted data.

Once you have all that, get a whiteboard or diagramming tool and scope out your code. Diagram out how each module will interact with each other module.

  • insert other steps here

Then start coding. And when your code doesn't work, THEN you come back to us here at SO and ask why.

Russell Uhl
  • 3,755
  • 2
  • 16
  • 27