"SSLHandshakeException: Couldn't find trusted certificate" when POSTing

... to a https.
My Java application basically has to send a user name/password to a https login page. This is done through a Login dialog in the application.
I am at the very beginning, where I create an HTTPS connection. This is how the code looks like:
try
URL url = new URL("https://www.sun.com");
HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
conn.setDoOutput(true); // the default is false
conn.setDoInput(true); // if DoOutput is set to true, the default is false
conn.setRequestMethod("POST"); // Sets the request method to POST, and enable to send data
conn.setUseCaches (false); // No caching, we want the real thing.
// write arguments & Send POST output to the web server
DataOutputStream printout = new DataOutputStream(conn.getOutputStream ());
// ...Print args and GET response data, etc.
conn.disconnect();
catch(IOException ioe)
System.out.println(ioe);
============================================
As soon as I reach the line 'DataOutputStream printout = new DataOutputStream(conn.getOutputStream ());', the above exception is thrown.
What am I doing wrong?!? (If I am using a different https, for testing purposes, https://www.skipjackic.com/secure/echo.asp, I get back the correct response data).
Also, how do I know how to post values to certain fields (I don't know their names, only that they should receive username & password) located in a htm page?
Thank you.

While connecting to sun.com server, ur client program verifies the identity of the server whom it is connecting to(in a SSL connection). So ur java client program needs to send a 'TrustStore' file which wud contain the verification details of the identity of the server certificate. First, U need to download the server certificate & then using the 'keytool' utility, u need to create a TrustStore file(which wud be later passed to ur java client program).

Similar Messages

  • RMI over SSL under Web Start can't find trusted certificate

    I have implemented RMI over SSL to get a Java EJB Client application talking to a JRun server over SSL. It works fine from the command line, but when I try to run it as a Web Start application, I get
    java.security.cert.CertificateException: Couldn't find trusted certificate
    (More complete stack trace below)
    I am using a test certificate, not one from a bona fide CA.
    I have tried putting the key store file in one of the jars used by the application, and adding:
    <argument>-Djavax.net.ssl.trustStore=jssecacerts</argument>
    and
    <argument>-Djavax.net.ssl.trustStore=jar:http://ip/app/xxx/lib/JarWithCacs.jar!/jssecacerts</argument>
    to no avail.
    If I copy the jssecacerts to Web Start's jre/lib/security directory, it works fine.
    I have seen other postings that say to use keytool to update the JRE used by Web Start, but that kind of defeats the purpose of Web Start: zero admin client. I can't touch each user's machine.
    I have seen other posts saying to implement a more relaxed trust manager, but that doesn't seem right either.
    I am using JDK 1.4.1_02b6 on Win2k. This should be irrelevant: JRun 4 sp1a.
    Is there a way to specify the jssecacerts file in the jnlp file so Web Start will recognize it?
    Thanks for any help,
    John

    I think I have an answer:
    1) Package the truststore file in the client JAR file
    2) Add code to the client to copy the truststore from the JAR file to the client hard drive
    3) Add code to the client to set the truststore properties to refer to the file on the client hard drive
    <<code>>
    private void setupTrustStore() {
    try {
    // save truststore file to local disk
    File homeDir = new File(System.getProperty("user.home"));
    File trustStoreFile = new File(homeDir, "mytruststore");
    URL url =
    this.getClass().getClassLoader().getResource("mytruststore");
    BufferedInputStream in =
    new BufferedInputStream(url.openStream());
    BufferedOutputStream out =
    new BufferedOutputStream(new FileOutputStream(trustStoreFile));
    while(true) {
    int data = in.read();
    if(data < 0) break;
    out.write(data);
    in.close();
    out.flush();
    out.close();
    // set truststore properties
    System.setProperty("javax.net.ssl.trustStore",
    trustStoreFile.getPath());
    System.setProperty("javax.net.ssl.trustStorePassword", "mypasswd");
    } catch(Exception e) {
    e.printStackTrace();
    }

  • Couldn't find delivery channel when using Mail-Package

    Hi,
    I use the mail receiver adapter. If I configure the mail header data (sender, receiver, subject) in the adapter configuration everything works fine. But now I need a dynamic subject, so I thought of using "mail package". But now I get an error "Couldn't find receiver channel for message..."
    The mail package looks like this:
      <?xml version="1.0" encoding="UTF-8" ?>
      <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
      <Subject>[email protected]</Subject>
      <From>[email protected]</From>
      <To>[email protected]</To>
      <Content_Type>text/xml</Content_Type>
      <Content>This is my mail content</Content>
      </ns1:Mail>
    Has anyone an idea - thanks a lot - werner

    Hi Werner,
    some time ago I posted a weblogs
    which describes such a configuration
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    have a look at it
    BTW
    >>>>now I need a dynamic subject
    if you have sp14 or above then there's much
    easier method with adapter identifiers
    (then you can set the subject in message mapping )
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

  • Buying mac for first time....couldn't find better spot to post this

    Hi, I'm currently a pc user (well I use my brothers pc) and I'm really wanting to buy a mac but would like some feedback as to which one I should buy. My main reason for wanting a mac is to accelerate what I do with my digital photography and am impressed by the aperture program. I also love the iWork and iLife software. I'm torn between which system to purchase though, because I've never used a mac before in my life. The mini would be an inexpensive way to join the mac family but aperture wouldn't work well on it. The iMac intel seems to be where I see myself going but money is a consideration and I wouldn't know if bigger would be better. ie. would getting the 20" iMac be worth the extra money with the increase in clock speed. I could more afford the 17" with the memory upgrade I would need but am concerned that I would not be fully happy knowing that there is a faster and better one out there. Have any of you had experience in the performance difference between the 17" and 20" models. Any suggestions on my first mac purchase even if it is a serious rethinking to a different flavour of mac would be greatly appreciated. I'll be surfing the net too, in order to see if there are any rumours about new intel chips and new apples so I can decide if buying now would be best or wait till fall.
    thanks

    If you can save up some extra money, go with the 20" with 2GB of RAM and 256 of video RAM. Seeing as you are a photographer, you want the biggest, best picture you can get. And, being that the new Intel based iMacs are forced to run a lot of programs in emulation (under Rosetta), and that emulation takes up a lot of RAM, maxing out RAM on an Intel based iMac is almost necessary. Speed isn't really an issue; .13GHz won't really be noticeable. However, if Aperture is processor intensive (I don't know if it is or not, being that I've never actually used it), then you may notice a difference. The big issue is screen size. I'm on the 20" right now. I got used to it, and two days ago, went to the Apple store to check out the new MacBooks. I took a look at the 17" iMacs, and was astonished at how small they appeared. I really got used to a 20" screen, and couldn't imagine working on anything smaller. Now, as you seem to know, the Mac Mini isn't really an option; it's just not powerful enough for intensive digital management. So, again, I really think your best option would be the 20" iMac, with, at the least, 1GB of RAM, and 256MB of video RAM. It's pricey, but definitely worth it. And, it'll be a very powerful machine, and will most definitely last you a good 5, maybe 6 years. Keep in mind, you can always upgrade RAM yourself (I actually suggest you purchase RAM from an external company; it'll be much cheaper), but you can't upgrade video RAM further than the initial purchase.
    P.S. - Other World Computing offers very cheap, guaranteed compatible RAM for any Mac. Check it out. I got 1GB of RAM (for a total of 1.5GB) for $141 from them, including shipping. The same from Apple is $300.
    I really hope this helps!

  • Trust Certificates when linking to PDFs from another PDF

    Good Morning All,
    Running Acrobat Pro 9. I've created a pdf document with links to other pdf. All are located in main folder and all links work. The problem is that I keep getting the warning:
    If you trust the site, choose Allow. If you do not trust the site, choose Block.
    I've gone into preferences/Trust Manager/Change Settings/Allow All - Still getting the warning.
    Any help is appreciated.
    Thanks
    G

    I'll ask a question that may not help.
    Did you remake the pdf after changing the Trust settings?
    And it might not just be for the main PDF. It may be one of the satellite PDF. (meaning the ones linked to the the main PDF.)
    IF this is on a website, or even on a server, maybe all should be placed in a folder together.
    Just an idea.

  • How can i Use SERVLET with RMI to avoid trust certificate

    I know that for begining RMI, you must launch the server and the client.
    for the server i use :
    java -Djavax.net.ssl.trustStore=server.keystore -Djavax.net.ssl.keyStore=server.keystore -Djavax.net.ssl.keyStorePassword=server TestServer
    for the client I use :
    java -Djavax.net.ssl.trustStore=client.keystore -Djavax.net.ssl.keyStore=client.keystore -Djavax.net.ssl.keyStorePassword=client TestClient
    and all work fine.
    but i want to use a servlet for rmi client and i wrote this:
    public class AppelServlet extends HttpServlet
         public void doPost(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
              try
                   System.out.println("Registering secure RMI socket factory ...");
                   java.rmi.server.RMISocketFactory.setSocketFactory(new SecureRMISocketFactory());
              TestRemote test = (TestRemote) Naming.lookup("rmi://127.0.0.1:7123/TestClient");
    String reponse=test.toLowerCase("HELLO WORLD");
                   System.out.println("la reponse est : "+reponse);
         catch (Exception e)
              System.out.println("test client exception: " +e);
    PrintWriter out = response.getWriter();
              response.setContentType("text/html");
    and i have the following error on tomcat:
    Registering secure RMI socket factory ...
    test client exception: java.rmi.ConnectIOException: error during JRMP connection
    establishment; nested exception is:
    javax.net.ssl.SSLHandshakeException: Couldn't find trusted certificate
    i think i must precise how to indicate the truststore like in the first case.
    help me please.
    hamdi

    Hi,
    Try doing the following steps.
    Assuming you have a certificate obtained
    Export the certificate into a .cer file.
    On IE, goto tools->internet options->content->certificates, and export to a .cer file.
    Using keytool of java import the certificate to the store that can be used doing the following command.
    keytool -import -alias <ailas> -file < .cer filename> -keystore <storename here>
    set the javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword properties at the command prompt using the command below.
    java -Djavax.net.ssl.trustStore=<storename> -Djavax.net.ssl.trustStorePassword=<password> <classname>
    Let me know if this helped.
    Also take a look at this link for using RMI with SSL
    http://java.sun.com/products/jdk/1.2/docs/guide/rmi/SSLInfo.html
    Regards,
    Roopasri Vittal
    Developer Technical Support
    Sun Microsystems
    http://sun.com/developers/support

  • Not retrieving home made trusted certificates

    Hi,
    The aim is to use a server ( Tomcat ) to authenticate web users thanks to their certificate.
    I've imported with keytool trusted certificates made by OpenSsl when Iuse -list option I have for each certificate a 'trustedCertEntry' indication ( the CA certificate have been imported with -trustcacerts option ). It seems Ok.
    So I run Tomcat with -Djavax.net.debug=all option. No certificate is
    prompted. I tried the -genkey method, the key is seen at jvm starting but at handshake with the client I have a 'Could not find trusted certificate' fatal, description = certificate_unknown ( I understand that because client certificate and generated key don't match ).
    I don't know where I'm wrong, maybe it's in Tomcat's configuration. I'd like to know what's prompted where everythiing runs well.
    Thanks in advance,
    Christophe

    To add the home-made CaCertificate I used keytool without specifying the cacerts file from %JRE%\lid\security directory so keytool added it to %USER_PROFILE%\.keystore and Tomcat use this file to retrieve keys and not cacerts.
    Adding explicitly the filename to cacerts it works !!!!
    Christophe

  • Whenever I connect my 4th generation iPod thouch, all of the playlists on my iPod get deleted. This is very frustrating. Someone please help me? I searched the settings on iTunes and couldn't find anything.

    Whenever I connect my 4th generation iPod thouch, all of the playlists on my iPod get deleted. This is very frustrating. Someone please help me? I searched the settings on iTunes and couldn't find anything.

    Also, when I go on to safari, another alert pops up that safari cannot verify the identity of the website, anything that I type in to as common as google.com. It gives me 3 options to either cancel, look at details, and continue. I've looked at the details of the website of Google and it is legitimate the site. Any help?

  • Getting "No trusted certificate found" when attempting to connect to 10g DB

    Greetings,
    I have an Oracle 10g DB configured to listen via TCPS. I am able to tnsping and sql+ into the DB just fine. However, when attempting to connect via SQL Developer, I get the following error:
    *"Status: Failure -lo exception: sun.security.validator. ValidatorException: No trusted certificate found"*
    Here is my tnsnames.ora entry:
    EMCECCH01.CORPORATE.MY.COM =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCPS)(HOST = emcecch01.corporate.my.com)(PORT = 1575))
    (CONNECT_DATA =
    (SERVICE_NAME = rambdb)
         (SECURITY = (MY_WALLET_DIRECTORY = C:\DBSafes\Cincinnati\dbSafe))
    Obviously when I create my connection, I am using 'TNS'. I've also attempted to connect via the JDBC thin driver, but when testing the connection, it just sits and spins without ever returning a result. Here is the URL I'm using:
    jdbc:oracle:thin:@emcecch01.corporate.my.com:1575:rambdb
    I've verified that the appropriate JAR files are in place in the jlib directory.
    Any advice in this matter would be greatly appreciated.
    Regards

    Hi,
    If your connection entry is unusual you could try these simple things that may cause variation/different code paths:
    1/ORACLE_HOME being set /unset by for example a bat script before launching sqldeveloper [see in sqldeveloper help/about/properties/ oracle.home and jdbc.library to see what oracle is using]
    (you could be using sqldeveloper or other oracle install jdbc)
    2/Tools/preferences/database/Advanced Parameters/Use oci thick driver set/unset
    (you could be using 'pure' jdbc thin or 'mixture of c & java' ie. thick oci driver using another Oracle Home or instant client)
    3/use Connection type=advanced then you can enter a fancy description (these descriptions are simple but you could have load balancing for example):
    thin is pure java
    jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MACHINE_NAME_OR_IP)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=dev11gr1)))
    oci8 is thick/c/oci-java
    jdbc:oracle:oci8:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MACHINE_NAME_OR_IP)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=dev11gr1)))
    (or get SQLDev to look up tnsnames.ora, connection type = tns might work)
    Please post your findings and put in an enhancement request for particular connection feature support, documented with a test case.
    -Turloch

  • I've seen all the posts for fixing the wifi on the 4s, none of them work!  So, who can tell me why my iPhone 4S cannot find any wifi when it used to easily, and when it does it can never connect?

    I've seen all the posts for fixing the wifi on the 4s, none of them work!  So, who can tell me why my iPhone 4S cannot find any wifi when it used to find wifi, and when it does find a wifi network it can never connect?  You think apple would have a clue how to fix it!  Because turning the wifi on and off doesn't work, resorting network settings doesn't work, even restoring phone to factory default doesn't work...

    Did not work. I've selected iMessage to ON and left it. After a few hours I recieved a message "activation unsuccessful. Turn on iMessage to try again". This has been going on for the past 3 days.

  • IPod classic displays 'No music' after sync, HDD problem? Geschiedenis • Verwijder  So recently I synced my iPod Classic 160 GB like I did so many times and when I wanted to play some music afterwards it couldn't find any files on the iPod anymore. H

    So recently I synced my iPod Classic 160 GB like I did so many times and when I wanted to play some music afterwards it couldn’t find any files on the iPod anymore. However when you look in the settings it displays that ~roughly 90 GB free space is available. Seen the fact that I had about 60 gigs of music this doesn’t seem like a coincidence and I think my music is still somewhere on the ipod but the HDD isn’t recognizing it anymore.
    I’ve tried resetting it, and resetting it to factory settings, which didn’t work. When connected to a desktop it won’t be recognized by iTunes, it displays an error message that the iPod cannot be read and that I have to reset it to factory settings.
    I’ve spent some time researching this problem yesterday and I ran into a myriad of vaguely similar problems didn’t really offer any help. Currently I’m thinking that formatting the iPod might work, and restoring the software afterwards. However this is a rather bold strategy so I’d like to consult you here first.
    Thanks in advance!

    Hi turingtest2,
    Thank you for the info, with formatting my iPod I managed to connect it to iTunes again.
    However..in the page you linked to there is a section about how transferring large amounts of data can dump your library. That seems to be the problem in this case. It won't even allow me to transfer more than 2 gigabytes of music per sync, if I go higher it will dump everything again. Having over >60 GB of music in my library, this is disastrous to say the least.
    Do you think that there is any other solution besides the method you mentioned involving Smart Playlists?

  • HT1926 Installation of latest  itunes update stopped, gave error message re couldn't find MSVCR80.dll. Suggested reinstall. Tried but that generated same message. Now get that message when I try to open itunes. I have Windows XP. Help!

    Installation of latest itunes update stopped, gave error message "couldn't find MSVCR80.dll"  Suggested reinstall. Tried but got same message. Now get same error message when I try to open itunes. Help!

    Hey jeight26,
    When you uninstalled and reinstalled iTunes, did you use this article?
    iTunes 11.1.4 for Windows: Unable to install or open
    http://support.apple.com/kb/TS5376
    If you haven't already done these steps, this section contains information that might help your situation, as the order and manner which you uninstall has an effect on the outcome:
    Use the Control Panel to uninstall iTunes and related software components in the following order and then restart your computer:
    iTunes
    Apple Software Update
    Apple Mobile Device Support
    Bonjour
    Apple Application Support (iTunes 9 or later)
    Important: Uninstalling these components in a different order, or only uninstalling some of these components may have unintended affects.
    Let us know if following that article and uninstalling those components in that order helped the situation.
    Welcome to Apple Support Communities!
    Sincerely,
    Delgadoh

  • I want to reinstall our Adobe Acrobat XI Pro because we have begun to get error messages. I followed the initial instructions but when I logged in I couldn't find "My Orders" page which is required to locate my order and install.  Any ideas?

    I want to reinstall our Adobe Acrobat XI Pro because we have begun to get error messages. I followed the initial instructions but when I logged in I couldn't find "My Orders" page which is required to locate my order and install.  Any ideas?

    Barbara,
    If you are looking for your  serial number, sign in to your Adobe account. On the Manage Accounts page that appears, all of your registered products and their serial numbers are listed in the Plans & Products section. For more information on locating serial numbers,please see Find a serial number
    Here is the link to download and install the software:
    Acrobat XI, X
    Pattie

  • Error when installing Lion on empy HD: "Couldn't find app store version, falling back to hardcoded"

    I've run in to a problem that is making me tear the hair from my head. I'm hoping for your help!
    Short story:
    I'm trying to install OS X Lion on my 27" iMac.
    I've erased the HD using Disc Tool in recovery.
    HD shows no errors.
    I've tried Internet Recovery (it loads up, but wont start the installation)
    I've tried creating a recovery usb on another similar iMac, and use it on this. Same error, only differance is it keeps "loading" when installing, but nothing happens. Same error in log.
    When I try to start the Reinstall I get an error in the installation log that goes something like this:
    Install Mac OS X Lion[354:9c03] Couldn't find app store version, falling back to hardcoded
    Can not connect to /var/run/systemkeychaincheck.socket: No such file or directory
    Apple Care suggested:
    Trying another network (doesn't work).
    Install with the original Snow Leopard DVD first, then upgrade (can't do that, the DVD is lost and a DVD from another friend is not working)
    What can I do to get around this error?
    Someone suggested buying a usb with Snow Leopard from the apple store. Do I really have to buy a NEW operating system because the recovery doesn't work? Would I have to pay to upgrade to Lion again?

    Follow AppleCare's instructions on re-installing Snow Leopard and re-installing Lion. Your friends disc won't work because the discs are machine specific. You will have to get a replacement set of your original Install Discs from AppleCare for a nominal cost.

  • Hi I have a Iphone4 in using. I couldn't find Safary, E-mail and notes from my phone one day. I made this mistake when I want to delete some programe from my phone. Who can help I recovery my phone please.

    Hi
    I have a Iphone4 in using. I couldn't find Safary, E-mail and notes from my phone one day. I made this mistake when I want to delete some programe from my phone. Who can help I recovery my phone please.
    Thanks

    Hello, HenryWang2103.
    Thank you for visiting Apple Support Communities.
    The Safari, Email and Notes applications are native to the iOS and is unable to be deleted.  Since this is the case, they are either in a folder on the iPhone, on another page or Restrictions are enabled.  You can also search for these Apps on the iPhone by touching the screen and sliding your finger down.  Here is some information regarding these features.  The information about folders is located in the user guide below.
    iPhone User Guide
    iOS: Understanding Restrictions (Parental Controls)
    http://support.apple.com/kb/HT4213
    Cheers,
    Jason H.

Maybe you are looking for

  • Unable to load 32 bit client on 64 bit windows 7 Enterprise

    I got a new PC at work and tried doing my oracle installs but I keep having failures on the 32 bit Oracle client install. What happens is that the install proccedes without issue until the copy files step at which it freezes at 8% progress. When I lo

  • I just upgraded my itunes and now it doesn't play my music

    It seems only music I've purchased are playing; the rest does not.

  • Download Table Data into Excel with Less Size

    Hi All, In OBIEE 11.1.1.5, following are my finding of the File Sizes using Various Export Options. I have used Default SampleAppLite RPD and Webcat , Order Details Report No.of Records : 2000 Export Excel 2003+ (mht) : 3,812 KB Export Power Point 20

  • How to keep hyperlink from excel to PDF?

    I have some Hyperlinks in excel, and when i convert to PDF, they dont work. I already installed the Adobe Acrobat PRO XI (Trial version) How can i do this? tks

  • Load balancing in RAC 11.2

    Hello, what is the best practise for rman backups load balancing for 11.2 RAC. Should we use scan listener or should we use old method of allocating each channel to each node ?