Solved

HTTPS using JSSE in Oracle 8.1.5 java stored procedure

Posted on 2001-07-05
2
380 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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 …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

623 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