やりたかったこと
会社でリリースしているアプリに組み込んだ電子証明書の有効期限が確認したい
(windows7)
やったこと
1.openSSL for windowsの入手
下記リンクより、openSSL for windowsを入手
https://slproweb.com/products/Win32OpenSSL.html
2.openssl.exeにパスを設定
「システムのプロパティ」-「環境変数」の[path]にopensslの格納場所を設定。
3.openssl.exeの動作確認 on コマンドプロンプト
コマンドプロンプトで「openssl version」と入力
バージョン情報が確認できたため、無事opensslの導入は完了。
※何度か「序数●●●がダイナミックライブラリ●●●.dllから見つからなかったため~」というポップアップが表示されてコマンドが受け付けられないことがありましたが、都度そのdllファイルをwebから取得してやれば解決しました。
4.証明書ファイルの内容を確認(x509コマンド)
下記コマンドを入力して、証明書ファイルの有効期限を確認
openssl x509 -in output.pem -startdate -enddate -noout
※もともと持っていたのが#pkcs12形式だったので、事前にp12→pemに変換しています。
openssl pkcs12 -in input.p12 -out output.pem