2件ヒット
[1-2件を表示]
(0.021秒)
検索結果
-
OpenSSL
:: OCSP (115.0) -
OCSP(Online Certificate Status Protocol)を取り扱うための モジュールです。OCSP は 2560 で定義されています。
...示する
require 'openssl'
require 'net/http'
# ...
subject # 問い合わせ対象の証明書(Certificate オブジェクト)
issuer # subject の発行者の証明書(Certificate オブジェクト)
store # 信頼している証明書ストア
cid = OpenSSL::OCSP::CertificateId.new......issuer)
req = OpenSSL::OCSP::Request.new
req.add_certid(cid)
req.add_nonce
http = Net::HTTP.new('ocsp.example.com', 80)
httpres = http.post("/", req.to_der, 'content-type' => 'application/ocsp-request')
raise "HTTP error" if !httpres.kind_of?(Net::HTTPOK)
res = OpenSSL::OCSP::Respon......se.new(httpres.body)
puts "Response status: #{res.status_string}"
exit if res.status != OpenSSL::OCSP::RESPONSE_STATUS_SUCCESSFUL
basic_resp = res.basic
raise "nonce error" unless [-1, 1].include?(req.check_nonce(basic_resp))
unless basic_resp.verify([], store)
puts "verify respons... -
OpenSSL
:: SSL :: SSLSocket (43.0) -
ソケットをラップして SSL での認証と暗号通信を実現するためのクラスです。
...す。
=== 例
SSL/TLS サーバに接続して write します。
require 'socket'
require 'openssl'
include OpenSSL
ctx = SSL::SSLContext.new
ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_PEER, verify_hostname: true)
soc = TCPSocket.new('www.example.com', 443)
ssl = SSL:......stname = 'www.example.com' # SNI
ssl.connect
ssl.post_connection_check('www.example.com')
raise "verification error" if ssl.verify_result != OpenSSL::X509::V_OK
print ssl.peer_cert.to_text
# HTTP リクエストを送信
ssl.write("GET / HTTP/1.1\r\n")
ssl.write("Host: www.example.c...