Solved

HTTPS using JSSE in Oracle 8.1.5 java stored procedure

Posted on 2001-07-05
2
354 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
Comment Utility
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
Comment Utility


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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Updating Java 9 85
array220 challenge 8 44
wordmultiple challenge 12 87
maven example error 3 34
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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now