cancel
Showing results for 
Search instead for 
Did you mean: 

SSLException: Server certificate rejected by ChainVerifier

Former Member
0 Kudos

Hi,

Im working on a Project here in Brazil and i need to create a servlet that gets a file from the ABAP and creates a zip with this file.

After that, it posts the zip to the browser for download.

The problem is that when i send a request to the abap stack to get the file, i receive an exception with the message "iaik.security.ssl.SSLException: Server certificate rejected by ChainVerifier".

Here is my code:

<b>InputStream in = null;

try {

KeyStore key = KeyStore.getInstance("JKS");

SecureConnectionFactory factory = new SecureConnectionFactory(key, null);

HttpURLConnection conn;

zipOut.putNextEntry( new ZipEntry( filename ) );

URL url = traduzURL(address);

conn = factory.createURLConnection(url.toString());

in = conn.getInputStream();

byte[] buffer = new byte[4 * 1024];

int numRead;

long numWritten = 0;

while ((numRead = in.read(buffer)) != -1) {

zipOut.write(buffer, 0, numRead);

numWritten += numRead;

}

}

catch (Exception e) {

throw e;

}

finally

{

if (in != null){

in.close();

}

} </b>

Any ideas?

Regards,

Leonardo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Leonardo

You have to add the server certificate to the trusted certificates of the key store

 KeyStore key = KeyStore.getInstance("JKS"); 
 String alias = ...;
 Certificate cert = ...;
 key.setCertificateEntry(alias,cert);

I hope this help.

Best Regards

Jakub Krecicki

Answers (0)