views:

515

answers:

1

I'm trying to upgrade from BouncyCastle bcprov-jdk14-124.jar (oooold) to bcprov-jdk14-143.jar. When I replace the old jar with the new jar and build everything, my software will no longer establish an SSL connection, failing with a javax.net.ssl.SSLException: Received fatal alert: illegal_parameter. Googling for "bouncycastle javax.net.ssl.SSLException illegal_parameter" yields a whopping 4 results.

Any suggestions on where to start debugging this?

Additional context:

  • client is on WinXP
  • server on CentOS, using Oracle Application Server
  • The client is attempting to establish an SSL connection for an AXIS2 POST.
  • When the server uses bcprov-jdk14-143 and the client uses bcprov-jdk14-124, the POST succeeds, but when the client is upgraded to 143, I get this error
+1  A: 

I am a little bit confused about your setup. Your error is from JSSE but BC doesn't provide JSSE. I assume the error is from server, which uses SunJSSE. You probably use BC's TLS API from client to make the TLS connection (check if you have TlsProtocolHandler).

If this is the case, getting everything working is already a miracle on Java 1.4, I wouldn't upgrade anything. Before Java 5, Sun's JSSE is partially hard-wired to SunJCE so you are practically using 2 JCEs at the same time on the server. I played with TLS from BC before and I never got it working so you are way ahead of me :)

Why do you need to upgrade BC? In my opinion, there is no reason to use BC at all if you are on Java 1.4 or later. However, it requires code changes to remove it if you use TlsProtocolHandler.

The specific error is caused by server sending down a list of compression methods. There is no way to get around that. Nobody supports compression but they all send down a list with only Null method.

ZZ Coder
I'm running into another problem using AES/CTR/NoPadding in a CipherOutputStream (not writing out a partial block on .close()) that I hoped upgrading might fix. The 124 version of BC really is quite old, and it concerns me that I can't upgrade it.
retracile
I have determined that I can upgrade the client to BC 1.41 without breaking SSL (and it appears that the CTR problem was fixed somewhere between 1.24 and 1.41, which addresses my primary reason for upgrading to the latest BC release). But BC 1.42 and 1.43 break SSL with the described error.I still want to upgrade to the latest BC release, but the urgency is lower now.
retracile
Why don't you just remove BC? JSSE is the standard way to do TLS in Java. You need to change TlsProtocolHandler to SSLSocketFactory. Judging from how long the TLS bug has been in BC, very few people use it.
ZZ Coder
I'm not intentionally using BC for the TLS. I need BC for other encryption functionality (like CTR mode), so I can't just remove it. I'll have to look into the details of how Axis2 sets up TLS/SSL; perhaps it is using TlsProtocolHandler.
retracile