on 04-27-2007 7:27 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.