类:Mongo::Socket::OcspVerifier Private
Overview
此类是私有 API 的一部分。 应尽可能避免使用此类,因为它将来可能会被删除或更改。
OCSP 端点验证程序。
建立 TLS 连接后,此验证程序会检查服务器提供的证书,如果该证书包含 OCSP URI,则对指定 URI 执行 OCSP 状态请求(最多5个重定向)以验证证书状态。
在命名空间下定义
类: 响应
常量摘要
Loggable中包含的常量
实例属性摘要折叠
- # ca_cert ⇒ 对象 只读 private
- # cert ⇒ 对象 只读 private
- # cert_store ⇒ 对象 只读 private
- # host_name ⇒ 对象 只读 private
- # options ⇒ 对象 只读 private
实例方法摘要折叠
- # cert_id ⇒ 对象 private
-
#initialize (host_name, cert, ca_cert, cert_store, **opts) ⇒ OcspVerifier
构造函数
private
OcspVerifier 的新实例。
-
# ocsp_uris ⇒ Array<String>
private
指定服务器证书中的 OCSP URI。
- # timeout ⇒ 对象 private
-
# verify ⇒ true | false
private
证书是否已验证。
- # verify_with_cache ⇒ 对象 private
Loggable中包含的方法
#log_debug 、 #log_error 、 #log_ Fatal 、 #log_info 、 #log_warn 、 #logger
构造函数详情
#initialize (host_name, cert, ca_cert, cert_store, **opts) ⇒ OcspVerifier
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回 OcspVerifier 的新实例。
64 65 66 67 68 69 70 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 64 def 初始化(host_name, cert, ca_cert, cert_store, **opts) @host_name = host_name @cert = cert @ca_cert = ca_cert @cert_store = cert_store @options = opts end |
实例属性详细信息
# ca_cert ⇒对象(只读)
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
72 73 74 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 72 def ca_cert @ca_cert end |
# cert ⇒对象(只读)
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
72 73 74 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 72 def cert @cert end |
# cert_store ⇒对象(只读)
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
72 73 74 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 72 def cert_store @cert_store end |
# host_name ⇒对象(只读)
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
72 73 74 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 72 def host_name @host_name end |
# options ⇒对象(只读)
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
72 73 74 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 72 def @options end |
实例方法详细信息
# cert_id ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
100 101 102 103 104 105 106 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 100 def cert_id @cert_id ||= OpenSSL::OCSP::CertificateId.new( cert, ca_cert, OpenSSL::摘要.new('SHA1') ) end |
# ocsp_uris ⇒ Array<String>
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回指定服务器证书中的 OCSP URI。
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 79 def ocsp_uris @ocsp_uris ||= 开始 # https://tools.ietf.org/html/rfc 3546 #section- 2.3 # 禁止多个扩展具有相同的 oid。 ext = cert.扩展.检测 do |ext| ext.oid == ' authorityInfoAccess ' end if ext # 我们的测试证书有多个 OCSP URI。 ext.值.拆分(" \n ").SELECT do |line| line.start_with?(' OCSP - URI: ') end.map do |line| line.拆分(' : ', 2).last end else [] end end end |
# timeout ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
74 75 76 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 74 def 超时 [:timeout] || 5 end |
# verify ⇒ true | false
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
返回证书是否已验证。
127 128 129 130 131 132 133 134 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 127 def 验证 handle_Exceptions do return false if ocsp_uris.空? resp, errors = do_verify return_ocsp_response(resp, errors) end end |
# verify_with_cache ⇒对象
此方法是私有 API 的一部分。 您应尽可能避免使用此方法,因为它将来可能会被删除或更改。
108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/ Mongo/socket/ocsp_verifier.rb', line 108 def verify_with_cache handle_Exceptions do return false if ocsp_uris.空? resp = OcspCache.获取(cert_id) return return_ocsp_response(resp) if resp resp, errors = do_verify OcspCache.集(cert_id, resp) if resp return_ocsp_response(resp, errors) end end |