Solved

HTTPS using JSSE in Oracle 8.1.5 java stored procedure

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
json example 39 131
advertisement module in core php 4 144
VB Script to add site to Java Exception List 4 48
Spring Framework HTTPSession management 1 22
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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 different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

914 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

16 Experts available now in Live!

Get 1:1 Help Now