<p>I have an Java desktop application which connects directly with the DB (an Oracle). The application has multiple user accounts. What is the correct method to send the user's password (not DB password) over the network? I don't want to send it in plain text.</p>

[{'answer_id': 70184, 'author': 'Niyaz', 'author_id': 184, 'author_profile': 'https://Stackoverflow.com/users/184', 'pm_score': 0, 'selected': False, 'text': "<p>If you don't want to send the data in plain text, use encryption !!!</p>\n\n<p>Use some encryption algorithm such as AES, Twofish etc.</p>\n\n<p>You must also take into consideration where your client and server are. If they both are in the same machine, there is no use of using an encryption. If they are in different machines, use some encryption algorithm to send sensitive data.</p>\n\n<p>If YOU are checking the validity of the passwords, you can just send the hash of the password. Beware that this method will work only if you are comparing the password yourself. If some other application (out of your control) is doing the validation job, you cannot hash the password.</p>\n"}, {'answer_id': 70186, 'author': 'Mat Mannion', 'author_id': 6282, 'author_profile': 'https://Stackoverflow.com/users/6282', 'pm_score': 4, 'selected': True, 'text': '<p>You could connect over a secure socket connection, or hash the password locally before sending it to the database (or better, both) - Ideally, the only time the password should exist in plain text form is prior to hashing. If you can do all of that on the client side, more the better.</p>\n'}, {'answer_id': 70189, 'author': 'Haacked', 'author_id': 598, 'author_profile': 'https://Stackoverflow.com/users/598', 'pm_score': 2, 'selected': False, 'text': "<p>Agreed, never send the password the user chose in plaintext. However, short of using public key cryptography, if you email them a password, it's going to be in cleartext. One thing I've seen often happen is that when the user forgets the password and requests it being sent to them, the system generates a new password and sends <em>that</em> one to the user. The user can then change the password.</p>\n\n<p>This way, the password the user chose (which the user might use elsewhere) is never sent, while their temporary password is sent in plaintext, they should change it soon after.</p>\n"}, {'answer_id': 70469, 'author': 'Rejeev Divakaran', 'author_id': 10980, 'author_profile': 'https://Stackoverflow.com/users/10980', 'pm_score': 2, 'selected': False, 'text': '<p>You can use SSL connection between Oracle client and Oracle database. To configure SSL between oracle client and server using JDBC:</p>\n\n<p>At server side:</p>\n\n<p>1) First of all, the listener must be configured to use the TCPS protocol:</p>\n\n<pre><code>LISTENER = (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcps)(HOST=servername)(PORT=2484)))\n\nWALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/server/wallet/path/)))\n</code></pre>\n\n<p>At client side:</p>\n\n<p>1) following jars needs to be classpath\n<code>ojdb14.jar</code>, <code>oraclepki.jar</code>, <code>ojpse.jar</code></p>\n\n<p>2) URL used for connection should be:</p>\n\n<pre><code>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=servername)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=servicename)))\n</code></pre>\n\n<p>3) Following properties needs to be set (either as System property (-D options) or properties to connection)</p>\n\n<pre><code>javax.net.ssl.trustStore, \njavax.net.ssl.trustStoreType, \njavax.net.ssl.trustStorePassword\n</code></pre>\n\n<p>Reference: <a href="http://www.oracle.com/technology/tech/java/sqlj_jdbc/pdf/wp-oracle-jdbc_thin_ssl_2007.pdf" rel="nofollow noreferrer">http://www.oracle.com/technology/tech/java/sqlj_jdbc/pdf/wp-oracle-jdbc_thin_ssl_2007.pdf</a></p>\n'}, {'answer_id': 75725, 'author': 'eckes', 'author_id': 13189, 'author_profile': 'https://Stackoverflow.com/users/13189', 'pm_score': 0, 'selected': False, 'text': "<p>If you connect directly to the DB with no middle layer, you should consider using a DB user for each real user, because otherwise you can't really secure the access of the application. </p>\n\n<p>If you connect to Oracle with ORa*Net the user password is automatically encrypted (since Oracle 8) however it might fall back to unencrypted passwords in some situations. This can be disabled with <code>ORA_ENCRYPT_LOGIN=true</code> in the environment of the client.</p>\n"}]
['https://Stackoverflow.com/questions/70170', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/518/']