End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
OpenSSL::SSL::SSLSocket#peer_cert_chain
ssl.peer_cert_chain => [cert, ...] or nil
ext/openssl/ossl_ssl.c
View on GitHub ↗
static VALUE
ossl_ssl_get_peer_cert_chain(VALUE self)
{
SSL *ssl;
STACK_OF(X509) *chain;
X509 *cert;
VALUE ary;
int i, num;
GetSSL(self, ssl);
chain = SSL_get_peer_cert_chain(ssl);
if(!chain) return Qnil;
num = sk_X509_num(chain);
ary = rb_ary_new2(num);
for (i = 0; i < num; i++){
cert = sk_X509_value(chain, i);
rb_ary_push(ary, ossl_x509_new(cert));
}
return ary;
}
The X509 certificate chain for this socket’s peer.
See also
#peer_cert
#peer_finished_message
#npn_protocol
#pending
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1