Giter Club home page Giter Club logo

Comments (7)

skiunke avatar skiunke commented on September 24, 2024 1

This fixed the issue.
I moved the sslclienttrust and sslserverkeys to the main folder and call them with src/main/...

from sslsocket.

williamswhy avatar williamswhy commented on September 24, 2024

The trust and key files from previous commits are not valid anymore. They were generated by the old default algorithm in keytool which is DSA but RSA is needed now. You can try the steps to generate keys in the readme fine under bin folder. Let me know if it works for you!

from sslsocket.

williamswhy avatar williamswhy commented on September 24, 2024

I just walked through the README myself. I think the steps are correct. Let me know if you find any problem. Thank you!

from sslsocket.

skiunke avatar skiunke commented on September 24, 2024

Unfortunately this didn't work.
I followed the readme guide on 7be23ce
I had to add the -keyalg RSA to generate.

keytool -genkey -alias sslclient -keystore sslclientkeys
Export client keystore as certification

keytool -export -alias sslclient -keystore sslclientkeys -file sslclient.cer
Create a server keystore file

keytool -genkey -alias sslserver -keystore sslserverkeys
Import client's certification into server's truststore

keytool -import -alias sslclient -keystore sslservertrust -file sslclient.cer 
Import server's certification into client's truststore

keytool -import -alias sslserver -keystore sslclienttrust -file sslserver.cer 
To view your keystore or trust

keytool -list -keystore sslclienttrust

(The export of the server keystore as certification command is missing)
Am i missing something? Do i need to add them to the lib/security/cacerts ?

from sslsocket.

williamswhy avatar williamswhy commented on September 24, 2024

The latest README is in the current master branch. The one you have is an older version.

from sslsocket.

skiunke avatar skiunke commented on September 24, 2024

Used this:

Create a server keystore file:

keytool -genkey -keystore sslserverkeys -keyalg RSA
Export the key as a cert:

keytool -export -keystore sslserverkeys -file cert.cer -keyalg RSA
Add the cert to the trust store of the client:

keytool -import -keystore sslclienttrust -file cert.cer -keyalg RSA

then i copied them into my src folder. Same error message

in Server:
System.setProperty("javax.net.ssl.keyStore", "sslserverkeys");
System.setProperty("javax.net.ssl.keyStorePassword", "123456");

in Client:
System.setProperty("javax.net.ssl.trustStore", "sslclientkeys");
System.setProperty("javax.net.ssl.trustStorePassword", "123456");

from sslsocket.

williamswhy avatar williamswhy commented on September 24, 2024

I can reproduce this problem on the client-side if the password is wrong. On the server-side, I got NullPointerException. I am not really sure how you got both ends to throw this error.
With that being said, I usually put my SSL files in whichever folder I run the programs from (If you follow the commands in README, it should be the bin folder) so if you did not run the program from src, it might cause the issue.

from sslsocket.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.