Solved

HTTPS using JSSE in Oracle 8.1.5 java stored procedure

Posted on 2001-07-05
2
366 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
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

Suggested Solutions

Title # Comments Views Activity
session migration servlets 2 42
factorial example 4 48
varialbe initialization 11 37
American Express @Work site and Java 4 27
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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 learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…

829 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