How to download certificate for the first time programmatically?

Hi, I'm accessing a https server which has a self signed certificate for the first time. I was trying to download the certificate using like
cert = sslsession.getPeerCertificates()[0]
However I got the following exception: SSLPeerUnverifiedException
If I have the certificate on disk and I installed it using keytool to the keystore, I could see the keychain using this method. But is there a way in java to download the certificate for the first time?
Many thanks.
minji

hi ejp, thanks a lot for the link, it really helps a lot.
Now I'm having another problem. I could now download the certificate and store in my keystore. but if I immediately reconnect to the https web page, I still got the exception telling me the certificate was not found:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
This should not happen as I have already had this certificate in my keystore. If I rerun the program, there's no problem, indicating the certificate was really there. I first guessed I might have to again call System.setProperty("javax.net.ssl.trustStore", "mycacerts") but that does not help.
anybody with an idea?

Similar Messages

  • HT201302 I have a new iPod Touch and am trying to download photos for the first time.  Both iPhoto & Image Capture recognize the device but don't seem to recognize the photos, or at least I can't import them.  Nothing happens when I click on anything in e

    I have a new iPod Touch and am trying to download photos for the first time.  Both iPhoto & Image Capture recognize the device but don't seem to recognize the photos, or at least I can't import them.  Nothing happens when I click on anything in either.

    If you manually open iPhoto do you not see the photos?
    Maybe here:
    iOS: Unable to import photos or device not recognized as a camera
    Yu are trying to impoort photos taken by or saved to the iPod, right? If the photos were synced to the iPod then iPhot does not work.

  • After downloading updates for the first time, i was asked to restart my mac. it starting writing configuring installation. the staus bar just showed a little and remained like that for more than 3 hrs. i tried several times wit no success.

    after downloading updates for the first time, i was asked to restart my mac. it started writing configuring installation. the staus bar just showed a little and remained like that for more than 3 hrs. i tried several times wit no success. it has not updated my mac OS X 10.5.

    My clean install worked out alright, although I don't think it really fixed anything, rather gave me a couple more days of use 'till I have to send it in. Someone please help my get it running properly again...

  • How do I upload for the first time?  It just keeps saying updating 1 file.  Frustrating!

    How do I upload for the first time?  It just keeps saying updating 1 file.  Frustrating!

    Hi Mike,
    I would think (from your original post) that the document was created in Numbers '08. Numbers 3.2.2 will not open a Numbers '08 document. Hence the message to save in Numbers '09. It looks as though your colleague must export to Excel and send you the Excel version.
    Regards,
    Ian.

  • I've downloaded firefox for the first time. My internet works yet when I try and open the browser it says 'unable to connect'

    I can't seem to get firefox properly running on my computer. I've installed it, I have internet connection, yet when I open a window and try to go on a site, it says 'unable to connect'

    Hello Patrick O' D,
    In my experience t here are two different problems with the speed of firefox on startup
    # your os and setup
    # firefox - and exactly what you use with it
    Some factors will be down to your OS and for instance what does start up initially, many of those factors will affect other programmes/applications and not only firefox.
    Some other factors depend on Firefox and how you set that up, I always like to have the option to using Firebug but realise it cold clash with other software or slow down firefox startup so I only enable it as I need it. see for instance: https://addons.mozilla.org/en-US/firefox/performance/

  • Downloading iTunes for the first time in Windows 7, stuck on "publishing product information"

    It installed yesterday, but then I couldn't do anything with it.  Uninstalled ITunes and everything associated with the download, and can't get it installed again.  Now it is stuck on "publishing product information"...Please help!  Thank you!

    i have the same problem, and i dont know if ill be of much help, but just leave it. I left mine and within 10 minutes it was done installing. Although it gave me more problems, maybe you wont receive it

  • I need to download itunes on my computer for the first time. But it wont download

    I need to download itunes for the first time. but it wont download to my computer what can i do?

    What happens when you try to download iTunes?
    What computer OS and version do yur have?
    Where are you downloading it from?

  • Charging for the first time, charging for the first time

    I bought my first macbook pro today and was wondering how to charge it for the first time. I've drained out the battery it had from the beginning theres only 3% left

    I hear you - Now call them back and tell them to read their own suggestions before answering customer's questions without stopping to think if they're giving you the right suggestions - answers.
    And direct those so called geniuses to Apple's website - regarding what you read below.
    Portables with built-in batteries
    Current Apple portable computer batteries are pre-calibrated and do not require the calibration procedure outlined in this article. These computers use batteries that should be replaced only by an Apple Authorized Service Provider.
    MacBook 
    MacBook (13-inch, Late 2009) and later
    MacBook Air
    MacBook Air, all versions
    MacBook Pro
    MacBook Pro (13-inch, Mid 2009) and later
    MacBook Pro (15-inch, Mid 2009) and later
    MacBook Pro (Retina, Mid 2012)
    MacBook Pro (17-inch, Early 2009) and later

  • Anyone still up? I just purchased from the itunes store for the first time, and don't know how to get them downloaded to my ipod.

    Sigh.....really late and I want to go to sleep, but I just purchased some Itunes online for the first time, and I don't know how to download them to my ipod. I've never done it before, and it shouldn't be rocket science, but I can't find anything that tells me where to go to download my songs. It said something about check purchases, but I can't even find that screen.  I connected my ipod to the computer, and now it says CONNECTED...EJECT BEFORE DISCONNECTING. My BF set up the acct when he bought my ipod as a gift, and as I bought these songs for a special weekend I have planned I can't ask him how to do it.  HELP!  For some reason the password I always use is not recognized for my account... and since I can't get anyone from itunes without a proper log-in I'm at the mercy of all of you more versed in tech and itunes than I.  Is anyone still up that can help me out?

    It should keep asking for the password, because it's trying to check for purchases... As soon as you login, it will see you have pending downloads and create the downloads section on the left below Purchases under the Store section. Then it will start the music downloads there, as they will be listed one below the other.
    You could just try to check your account balance or view your account and that will trigger a password request too. You can just click on that and say that now iTunes keeps asking for the password and ask him to help you with that. Trick would be to interrupt him so that he carries on with another task after, so he doesn't notice the download. Or you carry on with email or browsing which you were "busy" with when iTunes interrupted you for the password (stupid iTunes)

  • How do I obtain the answers to my security questions if I am attempting to download purchase from iBooks for the first time?

    How do I obtain the answers to my security questions if I am attempting to download purchase from iBooks for the first time?

    Click here for information. If you've forgotten the answers to the security questions and can't get them emailed to you for some reason(the email may take a few hours to arrive), contact the iTunes Store staff via the link in that article.
    (85504)

  • I downloaded from iTunes a hd movie for the first time. What a disaster !                                                Keep stopping and looks like after 2 days has not been downloaded. What am I suppose to do? Can I get my money back? How?

    I downloaded from iTunes a hd movie for the first time. What a disaster ! Keep stopping and looks like after 2 days has not been downloaded. What am I suppose to do? Can I get my money back? How?

    Contact iTunes suport... http://www.apple.com/support/itunes/contact/
    It sounds like you might have a slow wifi internet connection?  How fast is it with a speed test from your iPad.

  • HT5312 how do i reset my security answers to allow me to download off a laptop for the first time?

    i am trying to download a film for the first time off a laptop but it's asking me for a answers to my security questions which i've forgot.
    how do i reset them?

    If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then you can try going to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you might see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address then see if the instructions on this user tip helps : https://discussions.apple.com/docs/DOC-4551

  • For the first time, I downloaded a podcast in the podcast app by clicking on the cloud icon. Now, every single play button for all of my podcast episodes is grayed out. Why can't I play any of my podcasts any more?

    For the first time, I downloaded a podcast in the podcast app by clicking on the cloud icon. Now, every single play button for all of my podcast episodes is grayed out. Why can't I play any of my podcasts any more?

    Greetings Heather,
    After reading your post, it sounds like you are experiencing an error with the Podcasts app. You may want to consider restarting the device first, and then resetting if that does not work. This article provides detailed instructions for Restarting, and Reseting:
    Turn your iOS device off and on (restart) and reset
    How to restart
    Press and hold the Sleep/Wake button on the top of your device until the red slider appears. Then drag the slider to turn your device completely off.
    After the device turns off, press and hold the Sleep/Wake button again until you see the Apple logo.
    How to reset
    You should reset your device as a last resort and only if you can't restart it.
    To reset, press and hold both the Sleep/Wake and Home buttons for at least 10 seconds, until you see the Apple logo.
    Thank you for contributing to Apple Support Communities,
    BobbyD

  • I just bought a Shuffle for my wife. I have a Touch. When I plugged the Shuffle in for the first time it sync'ed with all my Touch stuff and filled up. I have created a playlist that I would like to install on the Shuffle. How do I keep the Shuffle from s

    I have a Touch. It sync's automaticly when I plug it in. I like this.
    I bought a Shuffle for my wife today. I want to put a playlist on it. When I plugged it in for the first time, it sync'ed with all my Touch stuff and is now full.
    How do I empty the Shuffle.
    How can I plug the Shuffle in if it automaticly fills up with my Touch stuff?
    I have windows xp.
    Thanks,
    Jeff

    Some apps that you download on your iPhone may possibly be to new for the iPod touch 2nd gen. I have a iPhone 5 and a iPod touch 2nd generation myself. If you plug his ipod into iTunes and restore it from a backup of your iPhone than it will download the paid apps and music that are compatible with his ipod. Hope this helps.

  • I've lost a load of notes, but dont know why or how to get them back. I cant find the folder that is in my Yahoo account that people have suggested might be the location for the messages.  I recently signed into iCloud for the first time.

    I've lost a load of notes, but dont know why or how to get them back. I cant find the folder that is in my Yahoo account that people have suggested might be the location for the messages.  I recently signed into iCloud for the first time.  Any idea how to get the notes back?   I really dont want to lose them.

    It should keep asking for the password, because it's trying to check for purchases... As soon as you login, it will see you have pending downloads and create the downloads section on the left below Purchases under the Store section. Then it will start the music downloads there, as they will be listed one below the other.
    You could just try to check your account balance or view your account and that will trigger a password request too. You can just click on that and say that now iTunes keeps asking for the password and ask him to help you with that. Trick would be to interrupt him so that he carries on with another task after, so he doesn't notice the download. Or you carry on with email or browsing which you were "busy" with when iTunes interrupted you for the password (stupid iTunes)

Maybe you are looking for

  • ENOENT

    i am having problem with non-blocking socket io when i compile with gcc. the code i am using is as follows myaddr.sin_family = AF_INET; myaddr.sin_port = htons (port); myaddr.sin_addr.s_addr = htonl (addr); flags = fcntl (skt, F_GETFL, 0); if ( flags

  • TS3297 The itunes "Purchased" page doesn't give me an option to view my past purchases, so I can download them

    I've been successfully downloading TV episodes from iTunes to my iPad 2.  This morning, when I went to iTunes to download some previously purchased materials, the "Purchased" page was blank, and there was no box in the upper left hand corner for me t

  • Datepicker set Maximum value

    All, I had this question come up recently. "Can we make it so user's cannot select a date after Today?" I found this blog: http://blog.whitehorses.nl/2010/04/16/oracle-apex-4-0-new-date-picker/ It states in there this info: The settings Minimum Date

  • Trouble Loading Elements 11 on MAC

     

  • Flash fullscreen not working properly

    When I click the fullscreen button on flash video players (YouTube, vimeo, etc), most of the time it fullscreens for a split second and then exits fullscreen. I have to spam the button really fast and get lucky for the fullscreen mode to "stick." Any