function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShrishailShrishail 

Sendinblue integration java.lang.RuntimeException: Could not generate DH keypair

Hi All,

I was trying to Call SENDINBLUE services from APEX Class  ( https://apidocs.sendinblue.com/?lang=en )

I am getting the following error  - System.CalloutException: java.lang.RuntimeException: Could not generate DH keypair

Following is the log.

17:16:54.045 (45234499)|USER_DEBUG|[23]|DEBUG|System.HttpRequest[Endpoint=https://api.sendinblue.com/v2.0/campaign/1, Method=GET]
17:16:54.045 (45241415)|SYSTEM_METHOD_EXIT|[23]|System.debug(ANY)
17:16:54.045 (45245388)|STATEMENT_EXECUTE|[24]
17:16:54.045 (45263829)|VARIABLE_SCOPE_BEGIN|[24]|http|System.Http|true|false
17:16:54.045 (45474869)|VARIABLE_ASSIGNMENT|[24]|http|"System.Http[]"|0x1b19bfb3
17:16:54.045 (45482896)|STATEMENT_EXECUTE|[25]
17:16:54.045 (45502186)|SYSTEM_METHOD_ENTRY|[25]|System.Http.send(ANY)
17:16:54.045 (45567511)|CALLOUT_REQUEST|[25]|System.HttpRequest[Endpoint=https://api.sendinblue.com/v2.0/campaign/1, Method=GET]
17:16:54.313 (313305474)|EXCEPTION_THROWN|[25]|System.CalloutException: java.lang.RuntimeException: Could not generate DH keypair

I contacted Sendinblue support - following is their responce

"SENDINBLUE -
Is it be possible to check the Java version used by APEX and Eclipse. As per our technical team's understanding the issue is with Java version 7 onwards.

Please check the links below for further informations.

http://stackoverflow.com/questions/10687200/java-7-and-could-not-generate-dh-keypair
http://stackoverflow.com/questions/14253039/is-there-a-workaround-for-java-lang-runtimeexception-could-not-generate-dh-key
http://stackoverflow.com/questions/6851461/java-why-does-ssl-handshake-give-could-not-generate-dh-keypair-exception
"

Can some one please help me with the information ?

Thanks a lot.


 
Abhi_TripathiAbhi_Tripathi
Hi Srishall,

In the debug that you are getting the error, please do share the code as well, to help you futher

Thanks
Abhi
Salesforce Developer
http://abhithetechknight.blogspot.in/
ShrishailShrishail

Hi Abhi , 

Thanks for the early response. Following is the code - The same code with the Java version instead of APEX works when runnig from Eclipse
public with sharing class MySforceHttpCallOut {

String endPoint = 'https://api.sendinblue.com/v2.0/campaign/1' ;

public void fetchDataFromRemote(){
   performAction('GET');    
}
  
public void performAction(String method){

             HttpRequest req = new HttpRequest();
            req.setEndpoint(endPoint);
             req.setHeader('api-key', 'GAVE MY API KEY HERE');
             req.setHeader('Content-Type', 'application/json');
             
             req.setMethod(method);
            
             System.debug(req);

             Http http = new Http();
             HTTPResponse res = http.send(req);   -> Failing HERE
            System.debug( res.getBody());
             Map<String,String> responseMap =   (Map<String,String>)JSON.deSerialize(res.getBody(),Map<String,String>.class);
              
              System.debug(responseMap);
              
  }
    
  
}

Thanks a lot.

Regards
Shrishail
gwrightgwright
Ive seen this as well, we have an application from SF that calls to our own servers, when our servers SSL is configured to have Diffie-Hellman key length of 2048 we get the error above, when set to 1024, it works fine, we need to have our servers use a key length of 2048, so is this a SF limitation?
fgwarb82fgwarb82
AFAIK (as far as I know), yes; as of time of writing this is a SFDC limitation.  I encountered this issue in 2012/2013, so it doesn't look like this will be resolved anytime soon.