-
I have built an Acceptor using QFJ, and wanted to add another layer of protection when a client connects to my engine, so I added:
to create this jks file I used:
and also I created a server.cer file using the command:
and to create the client.jks I used:
I then imported the client client.cer file into my server.jks using:
I tested it and all worked perfectly, client was able to connect to the server and also I tested that when the client does not send cert (SocketUseSSL=N) client is unable to connect. The problem is that when I change the client jks file to another cert (client2.jks), the client is still able to connect to the server even though I did not import the new cert .cer (client2.cer) file into the server .jks file. Is this the right logic? From what I could find online I saw that maybe I need to generate a .jks file and a .crt file then give the client the .crt file and on the client side do the same and then the client provide his .crt file. I could not find any clear example how should it work with QFJ, can someone please note all the steps and commend to achieve a secure SSL connection between client (initiator) and server (acceptor) thanks |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
Did you take a look at https://github.com/quickfix-j/quickfixj/blob/master/quickfixj-core/src/test/java/quickfix/mina/ssl/SSLCertificateTest.java AFAIR it also has tests for client authentication. |
Beta Was this translation helpful? Give feedback.
-
Truststore properties are used for certificate checks. It doesn't seem like you are configuring any. |
Beta Was this translation helpful? Give feedback.
-
Hi @chrjohn, @the-thing, thanks for the prompt response. I have looked at the examples now and it does connect to what @the-thing has mentioned that I am missing Truststore properties and this probably the reason why every cert been sent by the client is passing (although I validated that all messages are encrypted using wireshark). I am still not sure how the relationship between the keys .keystore and .truststore and client-server is done. When I look into the files I can see that server.keystore Entry type is PrivateKeyEntry and server1.truststore is Entry type: trustedCertEntry I tried to generate this logic using:
but I ended up with server1.truststore which has the same fingerprints as the server.keystore (and not a unique one of it is own like the one under quickfix example) but one has Entry type: trustedCertEntry and the other has Entry type: PrivateKeyEntry respectively. How do I generate all the 3 files server.keystore, server1.truststore, and client1.keystore also from client's perspective do I generate the client1.keystore for him and send it on a secure connection to use or does he need to generate it by himself and I just need to send him my server1.truststore Sorry for the long question, I have been working on this for a long time now. |
Beta Was this translation helpful? Give feedback.
-
Normally key stores contain certificate key-pairs and trust stores contain trusted certificates, but the file format e.g. JKS is the same so nothing stops you from using a single file for acceptor and initiator respectively. That's how QFJ did it initially and now we have to follow it. Client always validates server's certificate, but not vice versa, although this can be enforced. QFJ has a "feature" that when a trust store is not specified it will use a dummy one that will trust anyone. Not super nice, but this is for backwards compatibility. I can't advise on keytool command line tool, but I can suggest using "KeyStore Explorer" which is an excellent desktop application for key files and certificates manipulation. What you want to do is to generate acceptor's keystore file containing only a key pair entry. Then you want to export a certificate from that entry and send it to your client/initiator so the client can generate their own trust stores. That's it. It will use encrypted connection and client/initiator will validate server's certificate. If you want to do something custom you will have to play around a bit and find it for yourself. I have a feeling some new work has been given to you at the company. :) Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
@cypatorYA Was this helpful? Could this be marked as answered? |
Beta Was this translation helpful? Give feedback.
Normally key stores contain certificate key-pairs and trust stores contain trusted certificates, but the file format e.g. JKS is the same so nothing stops you from using a single file for acceptor and initiator respectively. That's how QFJ did it initially and now we have to follow it.
Client always validates server's certificate, but not vice versa, although this can be enforced. QFJ has a "feature" that when a trust store is not specified it will use a dummy one that will trust anyone. Not super nice, but this is for backwards compatibility.
I can't advise on keytool command line tool, but I can suggest using "KeyStore Explorer" which is an excellent desktop application for key files an…