LoginSignup
1
1

More than 1 year has passed since last update.

PowershellでSSL証明書情報取得時にTLSエラーにハマッた件

Posted at

はじめに

Powershell でサーバー証明書管理スクリプトでも作ってみた。
その際にまたもやハマッたTLSエラーの対応をここに綴る。※私の投稿はTLSエラーが多いです、、

以下取得コマンドでエラーが発生する。

$stream.AuthenticateAsClient($commonName)

"1"個の引数を指定して"AuthenticateAsClient"を呼び出し中に例外が発生しました:"SSPIへの呼び出しに失敗しました。内部例外を参照してください。"

エラーが起きる環境・前提条件

Windows Server 2016
Window 10 21H2 だったら正常にコマンドが通る。
恐らくこれもOS依存のTLSのバージョンの問題。

対応

技術系QA teratail に記載されていた情報(投稿主)をもとに以下パラメータを指定したらすんなり通った。

# 下記を参考にしてオーバーロード
# AuthenticateAsClient(String, X509CertificateCollection, SslProtocols, Boolean)
# Tls12:3072	TLS1.2セキュリティ プロトコルを指定します。
$stream.AuthenticateAsClient($commonName, $null, "3072", $false)

因みにteratailの投稿主は上記パラメータでもエラーになっており、そのため投稿していたみたい。
https://teratail.com/questions/329872?sort=2

1
1
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
1
1