on 01-03-2008 5:55 AM
Hi,
I have installed the correct certificate of the 3rd party system in my server in the following places in Visual Admin -> Services -> Key Storage:
1. As a default certificate
2. In the J2EE Engine Ticket Key Store
3. In J2EE Trusted CA?s
Now I need to programmatically use this certificate in generating the HTTPS connection from my SAP system to 3rd party system. I am not sure how to go about it. So it would be great if you could help.
Here is my code:
//Start of code
private StringBuffer sendRequest(BufferedReader input) {
StringBuffer serverResponse = new StringBuffer();
StringBuffer toServer = new StringBuffer();
StringBuffer fromServer = new StringBuffer();
try
{
String httpsURL = https://pi.ercot.com/servlet/piController;
try {
URL myurl = new URL(httpsURL);
// keystoreCAs keystore instance with trusted certificates
String ks = KeyStore.getDefaultType();
KeyStore keystoreCAs = KeyStore.getInstance("PKCS12");
keystoreCAs.load(null, null);
// Create factory
SecureConnectionFactory factory = new SecureConnectionFactory(keystoreCAs, null);
// Create the HTTPS connection
HttpURLConnection con = factory.createURLConnection(httpsURL);
con.setUseCaches(false); // Don't look at possibly cached data
con.setDoOutput( true );
con.setDoInput( true );
BufferedWriter br = new BufferedWriter( new OutputStreamWriter( con.getOutputStream() ));
br.write( "input=" );
while ( input.ready() )
{
br.write( (char)input.read() );
}
input.close();
BufferedReader serverReader = new BufferedReader( new InputStreamReader( con.getInputStream() ));
while( serverReader.ready() )
{
serverResponse.append( (char)serverReader.read() );
}
serverReader.close();
connServer.disconnect();
}
catch (MalformedURLException mue) {
System.out.println(httpsURL + " is not a URL that can be resolved");
}
catch (CertificateException ce) {
ce.printStackTrace();
}
}
catch (Exception e) {
e.printStackTrace();
}
return serverResponse;
}
//End of code
Now I am getting an exception as shown below:
iaik.security.ssl.SSLException: Server certificate rejected by ChainVerifier
The line causing this exception is highlighted in BOLD above.
Please let me know the reason for this.
Thanks,
Ajay
Edited by: Ajay Singh on Jan 3, 2008 6:57 AM
Tried out the code given in that particular link. It doesn't seem to help. Still getting the same error.
Thanks,
Rishi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.