Sun JSSE -- Weblogic Compatibility - Weblogic

This is a discussion on Sun JSSE -- Weblogic Compatibility - Weblogic ; Hi All, I am Guru Dutt. I am trying to connect to a secure site using the sun JSSE API on Weblogic, in JSP's Preconditions: * Changed the Security.policy file for adding SUN provider under C:\bea\jdk131_06\jre\lib\security\ * Added jsse.jar, jnet.jar, ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Sun JSSE -- Weblogic Compatibility

  1. Sun JSSE -- Weblogic Compatibility

    Hi All,
    I am Guru Dutt. I am trying to connect to a secure site using the sun
    JSSE API on Weblogic, in JSP's

    Preconditions:
    * Changed the Security.policy file for adding SUN provider under
    C:\bea\jdk131_06\jre\lib\security\

    * Added jsse.jar, jnet.jar, jcert.jar into weblogic's classpath
    * added the JSSE jar's in the the \ext directory.

    ********** The JSP File *********************88

    <%@ page import="com.sun.net.ssl.SSLContext,
    javax.net.ssl.SSLSocketFactory, com.sun.net.ssl.TrustManager,
    com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection,
    javax.security.cert.X509Certificate,
    com.sun.net.ssl.KeyManagerFactory, java.security.KeyStore"%>
    <%@ page import="com.sun.net.ssl.TrustManagerFactory,java.io.Buffer edReader,
    java.io.BufferedWriter, java.io.IOException,
    java.io.InputStreamReader, java.io.OutputStreamWriter,
    java.io.PrintWriter, java.io.FileInputStream, java.net.URL"%>
    <%@ page import="javax.net.ssl.SSLSocket,import java.io.PrintStream"%>

    <%
    URL tempUrl = new URL("https://www.versign.com/");
    String host = tempUrl.getHost();
    int port = tempUrl.getPort();
    String path = tempUrl.getPath();
    String query = tempUrl.getQuery();
    SSLSocketFactory factory = null;
    try{
    SSLContext ctx;
    KeyManagerFactory kmf;
    KeyStore ks;
    char[] passphrase = "passphrase".toCharArray();
    ctx = SSLContext.getInstance("https");
    TrustManagerFactory tmf =
    TrustManagerFactory.getInstance("SunX509", "SunJSSE");


    kmf = KeyManagerFactory.getInstance("SunX509");
    ks = KeyStore.getInstance("JKS");
    ks.load(new FileInputStream("testkeys"), passphrase);
    kmf.init(ks, passphrase);
    tmf.init(ks);
    ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
    factory = ctx.getSocketFactory();
    SSLSocket socket = (SSLSocket)factory.createSocket(host, 443);
    out.println("after connection");
    socket.startHandshake();
    PrintWriter printOut = new PrintWriter(new BufferedWriter(new
    OutputStreamWriter(socket.getOutputStream())));
    printOut.println("GET " + path + " HTTP/1.1");
    printOut.println();
    printOut.flush();
    BufferedReader in = new BufferedReader(new
    InputStreamReader(socket.getInputStream()));
    String inputLine =null;
    String inputString=null;

    while ((inputLine = in.readLine()) != null)
    inputLine=inputLine +inputString+"\n";
    out.println(inputLine);

    in.close();
    printOut.close();
    socket.close();
    } catch (Exception e) {
    out.println(e);
    PrintWriter printStream = new PrintWriter(out);
    e.printStackTrace(printStream);
    while(printStream!=null)
    printStream.println();
    }
    %>

    ****************
    Error Report
    ***********

    java.security.NoSuchAlgorithmException:
    Algorithm https not available java.security.NoSuchAlgorithmException:
    Algorithm https not available at
    com.sun.net.ssl.SunJSSE_b.a(DashoA6275) at
    com.sun.net.ssl.SSLContext.getInstance(DashoA6275) at
    jsp_servlet.__httpsconnection._jspService(__httpsc onnection.java:126)
    at
    weblogic.servlet.jsp.JspBase.service(JspBase.java: 27) at
    weblogic.servlet.internal.ServletStubImpl$ServletI nvocationAction.run(ServletStubImpl.java:1058)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeSe rvlet(ServletStubImpl.java:401)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeSe rvlet(ServletStubImpl.java:306)
    at
    weblogic.servlet.internal.WebAppServletContext$Ser vletInvocationAction.run(WebAppServletContext.java :5445)
    at
    weblogic.security.service.SecurityServiceManager.r unAs(SecurityServiceManager.java:780)
    at
    weblogic.servlet.internal.WebAppServletContext.inv okeServlet(WebAppServletContext.java:3105)
    at
    weblogic.servlet.internal.ServletRequestImpl.execu te(ServletRequestImpl.java:2588)
    at
    weblogic.kernel.ExecuteThread.execute(ExecuteThrea d.java:213) at
    weblogic.kernel.ExecuteThread.run(ExecuteThread.ja va:189)
    ..................................................
    .................................................. ....

    Adv thanks if anyone can tell what is the workaround

    Regards,
    Guru Dutt.

  2. Re: Sun JSSE -- Weblogic Compatibility

    Maybe sun JSSE doesn't like the "https" being specified, I think it is
    expecting the
    SSL version there ("SSL", "SSLV3", "TLS", etc...)

    > ctx = SSLContext.getInstance("https");


    Tony

    "Guru Dutt" wrote in message
    news:d4b0c2e7.0307242236.57b5d35b@posting.google.c om...
    > Hi All,
    > I am Guru Dutt. I am trying to connect to a secure site using the sun
    > JSSE API on Weblogic, in JSP's
    >
    > Preconditions:
    > * Changed the Security.policy file for adding SUN provider under
    > C:\bea\jdk131_06\jre\lib\security\
    >
    > * Added jsse.jar, jnet.jar, jcert.jar into weblogic's classpath
    > * added the JSSE jar's in the the \ext directory.
    >
    > ********** The JSP File *********************88
    >
    > <%@ page import="com.sun.net.ssl.SSLContext,
    > javax.net.ssl.SSLSocketFactory, com.sun.net.ssl.TrustManager,
    > com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection,
    > javax.security.cert.X509Certificate,
    > com.sun.net.ssl.KeyManagerFactory, java.security.KeyStore"%>
    > <%@ page

    import="com.sun.net.ssl.TrustManagerFactory,java.io.Buffer edReader,
    > java.io.BufferedWriter, java.io.IOException,
    > java.io.InputStreamReader, java.io.OutputStreamWriter,
    > java.io.PrintWriter, java.io.FileInputStream, java.net.URL"%>
    > <%@ page import="javax.net.ssl.SSLSocket,import java.io.PrintStream"%>
    >
    > <%
    > URL tempUrl = new URL("https://www.versign.com/");
    > String host = tempUrl.getHost();
    > int port = tempUrl.getPort();
    > String path = tempUrl.getPath();
    > String query = tempUrl.getQuery();
    > SSLSocketFactory factory = null;
    > try{
    > SSLContext ctx;
    > KeyManagerFactory kmf;
    > KeyStore ks;
    > char[] passphrase = "passphrase".toCharArray();
    > ctx = SSLContext.getInstance("https");
    > TrustManagerFactory tmf =
    > TrustManagerFactory.getInstance("SunX509", "SunJSSE");
    >
    >
    > kmf = KeyManagerFactory.getInstance("SunX509");
    > ks = KeyStore.getInstance("JKS");
    > ks.load(new FileInputStream("testkeys"), passphrase);
    > kmf.init(ks, passphrase);
    > tmf.init(ks);
    > ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
    > factory = ctx.getSocketFactory();
    > SSLSocket socket = (SSLSocket)factory.createSocket(host, 443);
    > out.println("after connection");
    > socket.startHandshake();
    > PrintWriter printOut = new PrintWriter(new BufferedWriter(new
    > OutputStreamWriter(socket.getOutputStream())));
    > printOut.println("GET " + path + " HTTP/1.1");
    > printOut.println();
    > printOut.flush();
    > BufferedReader in = new BufferedReader(new
    > InputStreamReader(socket.getInputStream()));
    > String inputLine =null;
    > String inputString=null;
    >
    > while ((inputLine = in.readLine()) != null)
    > inputLine=inputLine +inputString+"\n";
    > out.println(inputLine);
    >
    > in.close();
    > printOut.close();
    > socket.close();
    > } catch (Exception e) {
    > out.println(e);
    > PrintWriter printStream = new PrintWriter(out);
    > e.printStackTrace(printStream);
    > while(printStream!=null)
    > printStream.println();
    > }
    > %>
    >
    > ****************
    > Error Report
    > ***********
    >
    > java.security.NoSuchAlgorithmException:
    > Algorithm https not available java.security.NoSuchAlgorithmException:
    > Algorithm https not available at
    > com.sun.net.ssl.SunJSSE_b.a(DashoA6275) at
    > com.sun.net.ssl.SSLContext.getInstance(DashoA6275) at
    > jsp_servlet.__httpsconnection._jspService(__httpsc onnection.java:126)
    > at
    > weblogic.servlet.jsp.JspBase.service(JspBase.java: 27) at
    >

    weblogic.servlet.internal.ServletStubImpl$ServletI nvocationAction.run(Servle
    tStubImpl.java:1058)
    > at
    >

    weblogic.servlet.internal.ServletStubImpl.invokeSe rvlet(ServletStubImpl.java
    :401)
    > at
    >

    weblogic.servlet.internal.ServletStubImpl.invokeSe rvlet(ServletStubImpl.java
    :306)
    > at
    >

    weblogic.servlet.internal.WebAppServletContext$Ser vletInvocationAction.run(W
    ebAppServletContext.java:5445)
    > at
    >

    weblogic.security.service.SecurityServiceManager.r unAs(SecurityServiceManage
    r.java:780)
    > at
    >

    weblogic.servlet.internal.WebAppServletContext.inv okeServlet(WebAppServletCo
    ntext.java:3105)
    > at
    >

    weblogic.servlet.internal.ServletRequestImpl.execu te(ServletRequestImpl.java
    :2588)
    > at
    > weblogic.kernel.ExecuteThread.execute(ExecuteThrea d.java:213) at
    > weblogic.kernel.ExecuteThread.run(ExecuteThread.ja va:189)
    > .................................................
    > .................................................. ...
    >
    > Adv thanks if anyone can tell what is the workaround
    >
    > Regards,
    > Guru Dutt.




+ Reply to Thread