0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Powershellでクライアント認証が必要なWebサイトへアクセスする(pfx証明書)

Last updated at Posted at 2023-04-09

やり方

Windowsにインストールされている証明書を使う場合

PCに保存されている証明書の一覧を表示

PowerShell
Get-ChildItem -path cert:\CurrentUser -Recurse

↑の実行結果から、使用したい証明書のThumbPrintをコピー

先ほどコピーしたThumbPrintをxxxxxxxxの部分に貼り付けて実行

PowerShell
Invoke-WebRequest https://example.com -CertificateThumbprint "xxxxxxxx"

フォルダに保存している証明書を利用する場合

PowerShell
pfx = [System.IO.File]::ReadAllBytes('pfxファイルのパス')
cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new($pfx, 'pfxファイルのパスワード')
Invoke-WebRequest https://example.com -Certificate $cert
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?