Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

FTPSClient - SSL Received fatal alert: bad_record_mac

843811May 12 2009 — edited Jun 11 2009
I am trying to connect to an out of network server using org.apache.commons.net.ftp.FTPSClient
and trying to upload a file.
The code works correctly when i execute it from localhost but throws the following exception from prod server.

javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1682)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:932)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1139)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123)
at org.apache.commons.net.ftp.FTPSClient.sslNegotiation(FTPSClient.java:240)
at org.apache.commons.net.ftp.FTPSClient._connectAction_(FTPSClient.java:171)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:178)

Code
FTPClient ftp = new FTPSClient("SSL")
ftp.connect(server, 21);

reply = ftp.getReplyCode();

if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
log.debug("FTP server refused connection.");
return;
}
//ftp.enterRemotePassiveMode();
ftp.enterLocalPassiveMode();

ftp.login(username, password);

======================
Any suggestions why would it work from my localhost and not from the server.
Could it be a firewall issue or do i need to user a certificate?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 9 2009
Added on May 12 2009
5 comments
681 views