NAME

Crypt::OpenSSL3::SSL - An SSL connection

VERSION

version 0.002

SYNOPSIS

my $ctx = Crypt::OpenSSL3::SSL::Context->new;
$ctx->set_default_verify_paths;

my $ssl = Crypt::OpenSSL3::SSL->new($ctx);
$ssl->set_verify(Crypt::OpenSSL3::SSL::VERIFY_PEER);
$ssl->set_fd(fileno $socket);
$ssl->set_tlsext_host_name($hostname);
$ssl->set_host($hostname);

my $ret = $ssl->connect;
die 'Could not connect: ' . $ssl->get_error($ret) if $ret <= 0;

my $w_count = $ssl->write("GET / HTTP/1.1\r\nHost: www.google.com\r\n\r\n");
die 'Could not write: ' . $ssl->get_error($w_count) if $w_count <= 0;
my $r_count = $ssl->read(my $buffer, 2048);
die 'Could not write: ' . $ssl->get_error($r_count) if $r_count <= 0;

DESCRIPTION

This is the main SSL/TLS class which is created by a server or client per established connection. This actually is the core class in the SSL API. At run-time the application usually deals with this class which has links to mostly all other classes.

Methods in this class generally match functions the SSL_* namespace in libssl.

METHODS

new

accept

accept_connection

accept_stream

add_client_CA

check_private_key

clear

clear_mode

clear_options

client_version

connect

copy_session_id

do_handshake

get_accept_connection_queue_len

get_accept_stream_queue_len

get_alpn_selected

get_blocking_mode

get_certificate

get_cipher_list

get_connection

get_context

get_current_cipher

get_domain

get_domain_flags

get_finished

get_peer_certificate

get_pending_cipher

get_error

get_event_timeout

get_fd

get_listener

get_mode

get_num_tickets

get_options

get_peer_finished

get_privatekey

get_read_ahead

get_rbio

get_rfd

get_rpoll_descriptor

get_security_level

get_session

get_servername

get_servername_type

get_ssl_method

get_stream_id

get_stream_type

get_verify_result

get_version

get_wbio

get_wfd

get_wpoll_descriptor

handle_events

has_pending

in_accept_init

in_before

in_connect_init

in_init

is_connection

is_domain

is_dtls

is_init_finished

is_listener

is_server

is_stream_local

is_tls

is_quic

listen

net_read_desired

net_write_desired

new_domain

new_from_listener

new_listener

new_listener_from

new_session_ticket

new_stream

peek

pending

read

rstate_string

rstate_string_long

sendfile

session_reused

set_accept_state

set_alpn_protos

set_blocking_mode

set_cipher_list

set_ciphersuites

set_connect_state

set_default_stream_mode

set_fd

set_host

set_incoming_stream_policy

set_initial_peer_addr

set_max_proto_version

set_min_proto_version

set_mode

set_num_tickets

set_options

set_post_handshake_auth

set_read_ahead

set_rbio

set_rfd

set_security_level

set_session

set_session_id_context

set_tlsext_host_name

set_verify

set_verify_depth

set_wbio

set_wfd

shutdown

state_string

state_string_long

stream_conclude

stream_reset

use_PrivateKey

use_PrivateKey_ASN1

use_PrivateKey_file

use_certificate

use_certificate_ASN1

use_certificate_chain_file

use_certificate_file

verify_client_post_handshake

version

write

CONSTANTS

ERROR_NONE
ERROR_SSL
ERROR_SYSCALL
ERROR_WANT_ACCEPT
ERROR_WANT_ASYNC
ERROR_WANT_ASYNC_JOB
ERROR_WANT_CONNECT
ERROR_WANT_READ
ERROR_WANT_WRITE
ERROR_WANT_X509_LOOKUP
ERROR_ZERO_RETURN
VERIFY_NONE
VERIFY_PEER
VERIFY_CLIENT_ONCE
VERIFY_FAIL_IF_NO_PEER_CERT
VERIFY_POST_HANDSHAKE
TLS1_VERSION
TLS1_1_VERSION
TLS1_2_VERSION
TLS1_3_VERSION
DTLS1_VERSION
DTLS1_2_VERSION
QUIC1_VERSION
FILETYPE_ASN1
FILETYPE_PEM
MODE_ACCEPT_MOVING_WRITE_BUFFER
MODE_ASYNC
MODE_AUTO_RETRY
MODE_ENABLE_PARTIAL_WRITE
MODE_RELEASE_BUFFERS
MODE_SEND_FALLBACK_SCSV
ACCEPT_CONNECTION_NO_BLOCK
ACCEPT_STREAM_NO_BLOCK
DOMAIN_FLAG_BLOCKING
DOMAIN_FLAG_LEGACY_BLOCKING
DOMAIN_FLAG_MULTI_THREAD
DOMAIN_FLAG_SINGLE_THREAD
DOMAIN_FLAG_THREAD_ASSISTED
INCOMING_STREAM_POLICY_ACCEPT
INCOMING_STREAM_POLICY_AUTO
INCOMING_STREAM_POLICY_REJECT
STREAM_FLAG_ADVANCE
STREAM_FLAG_NO_BLOCK
STREAM_FLAG_UNI
STREAM_TYPE_BIDI
STREAM_TYPE_NONE
STREAM_TYPE_READ
STREAM_TYPE_WRITE

AUTHOR

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2025 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.