Announcement

Collapse
No announcement yet.

Check HTTPS content with client certificate

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Check HTTPS content with client certificate

    Hello,
    I'm trying search string on web site, but i need use client certificate to get this site (cert is stored in LocalMachine\My).
    I can download site using this command, but this is just HTTP. May I ask you for any possibilities?
    Best regards

    Code:
    $page = (New-Object System.Net.WebClient).DownloadString("http://localhost")
    "$page"

  • #2
    Re: Check HTTPS content with client certificate

    Will this help?

    http://stackoverflow.com/questions/5...-in-powershell
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment


    • #3
      Re: Check HTTPS content with client certificate

      So I have code down bellow but still not work. Any idea?
      Best regards

      Code:
      #ignore untrusted certificate
      [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
      #load my client certificate defined by thumbprint
      $cert = Get-Childitem cert:\LocalMachine\My\5AA55B7B8D99
      #get web contetn
      $web = [System.Net.WebRequest]::Create($url)
      #use my client certificate
      $web.ClientCertificates.Add($Cert)

      Comment

      Working...
      X