LoginSignup
2
0

More than 3 years have passed since last update.

Macのcurl使ってクライアント証明書付きでアクセスするとcurl: (58) could not load PEM client certificateが出る

Posted at

MacでCurl使ってクライアント証明書を添付してアクセスすると

okanofumiaki@okano ~ % curl https://hogehoge.net/ -E ./user.pfx:password 
curl: (58) could not load PEM client certificate, LibreSSL error error:09FFF06C:PEM routines:CRYPTO_internal:no start line, (no key found, wrong pass phrase, or wrong file format?)

とエラーがでます。
どのように解決したかを記載します。

結論

homebrewにてopensslをインストールする

原因

MacOSにてopensslで呼び出されるモジュールはopensslではなくLibreSSL
opensslのバージョンを確認することで確かめられる。

okanofumiaki@okano ~ % openssl version
LibreSSL 2.8.3

まじか・・・・・

解決方法

opensslをインストールします。
ググればいろいろ出てきますが、

brewでopensslをインストール

brew install openssl

パスが通ってないのでbash_profileに書く

echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

bash_profileを読み込む

source ~/.bash_profile

opensslのバージョンを確認する

okanofumiaki@okano ~ % openssl version
OpenSSL 1.1.1d  10 Sep 2019

これでオッケー。

検索用キーワード

Mac
openssl
curl
client certificate
LibreSSL error
クライアント証明

余談

あ…ありのまま 今 起こった事を話すぜ!

「おれはopensslを実行していたと思っていが、opensslじゃなかった・・・」

な… 何を言っているのか わからねーと思うが 
おれも 何をされたのか わからなかった…
頭がどうにかなりそうだった… 催眠術だとか超スピードだとか
そんなチャチなもんじゃあ 断じてねえ
もっと恐ろしいものの片鱗を 味わったぜ…

2
0
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
2
0