Solved

HTTPS using JSSE in Oracle 8.1.5 java stored procedure

Posted on 2001-07-05
2
372 Views
Last Modified: 2008-02-01
> First Name:             fistdo
> Last Name:              fistdo
> E-mail Address:         fistdo@yahoo.com
>
> Had the following Feedback - Other:
>
> To whom may be interested:
>
> I have tried to deploy a http client within a java stored procedure
in Oracle 8.1.5. It's running fine using URLConnection. However, when I
switched it to HttpsURLConnection, it started giving
MalformedURLException: unknown protocol: https error inside oracle even with the JSSE
handler is set:
>
>         System.setProperty      
("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
>
>         Security.addProvider(new
com.sun.net.ssl.internal.ssl.Provider() );
>
> Could anyone shred some light on this please?
> Thanks in advance.
>
> (I realized that oracle 8.1.5 is using jre 1.1.7 and oracle 8.1.6 is
using 1.1.8_10, so I set the java.handler.protol.pkgs property as well
as java.protocol.handler.pkgs as well. But it isn't help at all.)
>
0
Comment
Question by:fistdo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
userquin earned 75 total points
ID: 6258906
Hi:

Try this -

public class Main {

HttpsURLConnection con= null;
SSLContext ctx;

public void doCertificate(String path_cert) throws .... {

     // Instantiate SSL Provider
     Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
     // Prepare URL class to support https protocol
     System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
     
     // init KeyStore
     KeyStore ks = KeyStore.getInstance("JKS");
     ks.load(null, null);
     
     CertificateFactory cf = CertificateFactory.getInstance("X.509");
     TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
     X509Certificate the_cert = (X509Certificate) cf.generateCertificate(new FileInputStream(path_cert));
     ks.setCertificateEntry("server_cert", the_cert);
     tmf.init(ks);
     
     ctx = SSLContext.getInstance("TLS");
     
     TrustManager[] tm = tmf.getTrustManagers();
     
     ctx.init(null, tm, null);
}

public void doHttps(String url) {

     HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
     URL url = new URL(urlRequest);
     con = (HttpsURLConnection)url.openConnection();

    // do something with HTTPS
    ....
    ....
}

Bye.

J.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 8974982


No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


-- points to userquin


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question