Java SSL DH Keypair Generation - Prime Size Error

前端 未结 4 583
忘掉有多难
忘掉有多难 2021-01-02 23:30

I\'m currently implementing Reddit OAuth2 login into my web app. The handshake and token exchange work fine when testing locally but when running on the server (hosted on \'

4条回答
  •  不知归路
    2021-01-03 00:10

    I solved the problem on oracle java 8 by switching to bouncycastle provider for ssl/tls:

    1. Added bouncycastle to my project

      
          org.bouncycastle
          bcprov-jdk15on
          1.54
      
      
    2. Before I do any SSL stuff, I add the BouncyCastle provider as 1st provider to the list:

      Security.insertProviderAt(new BouncyCastleProvider(),1);
      

    That's all. Now my connections to sites with 4096 bit DH parameters works as expected (I'm using Apache HTTP Client). This should also work with jdk 7.

提交回复
热议问题