views:

116

answers:

7

Hello all,

I'm new to SSL connections so here goes my question.

I have a desktop Java program in a JAR file. This JAR sends sensitive information over the internet to a remote Tomcat server. Of course I need to encrypt the data.

If I purchase an SSL cerfiticate say from Verisign, will the data sent over SSL be automatically encrypted?

I mean in my JAR, will I still need to do extra work like use Java encryption extensions API to manually encrypt my data over the SSL connection?

Thank you.

A: 

SSLSocket should handle most of the work for you.

YGL
+1  A: 

Follow the SSL Configuration HOW-TO on how to setup https.

stacker
A: 

All data sent over SSL is by definition encrypted, you do not need to worry about encryption at all. Also, you do not need to by a certificate to achieve that: you can issue one on your own.

pajton
+1  A: 

If your goal is just to get the encryptian, you don't need to buy a certificate. You can make your own. Buying a certificate just creates the verification chain back to verisign (or whomever) to give users a warm fuzzy that you're really who you say you are.

Jay
Ok thank you all for your help. I will attemp to create my own SSL connection without a certificate.
Marquinio
Jay, this is technically correct but probably bad advice for a beginner like Marquino. There is an additional configuration burden if you don't use certificates signed by a trusted authority.
GregS
Hmm, I'm not sure what the additional burden that you refer to is. When I've done this, I've simply written my validation callback to simply never throw the exception, i.e. always accept any certificate that it is offerred. If the goal is simply to get the transmission encrypted, than you don't care who issued the certificate. If the goal is to validate that this is a legitimate certificate, then I will plead ignorant on how one actually goes about doing that. I've never tried.
Jay
@Marquinio: Tehcnically, you still need a "certificate" to do SSL. The question is just whether you use a "self-signed certificate" or a certificate signed by a recognized authority.
Jay
@Jay: Thank you for your clarifying comments
GregS
A: 

If you'll set up the SSL on Tomcat and send your data over HTTPS then the encryption will be done for you. But you don't actually need to purchase a certificate if you only need encryption for your data channel, you could generate a self-signed certificate. Have a look at this page http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html on how to configure SSL for Tomcat. But note that HTTPS can be configured not to use encryption at all (at least on Apache httpd).

Andrius
+2  A: 

I mean in my JAR, will I still need to do extra work like use Java encryption extensions API to manually encrypt my data over the SSL connection?

Encryption will be done for you (with the Java Secure Socket Extension). Just establish your connection using https://. Maybe have a look at HTTP Client for a higher level API.

By the way, the certificate goes on the server side (unless you want to do client-authentication too in which case, well, you'll need a client certificate too).

And yes, you could use a self-signed certificate but one of the benefits of using a certificate signed by a well known Certificate Authority (CA) like Verisign, Thawte, etc is that you won't have to add it to the trust store of the client VM (unless you disable the verification mechanism).

Pascal Thivent
A: 

To answer your question, SSL implementations automatically encrypt the data. You don't need to worry about using additional encryption routines.

It might be easiest to purchase an SSL certificate because SSL implementations provide easy certification authentication using common root certificates and provide a verification service. However, you could save some money by using a self-signed certificate.

Even with a self-signed certificate, it's important to validate the signature on the server certificate from the desktop application when you connect to the server. This will prevent man in the middle attacks.

You won't have to add your self signed certificate to the store because you should be able to disable the automatic verification mechanism and use your own.

Marcus Adams