NAME

Net::mbedTLS::Server::SNICallbackCtx - SNI callback context

SYNOPSIS

my $tls_server = $mbedtls->create_server(
    servername_cb => sub {

        # This our class instance:
        #
        my ($sni_cb_ctx) = @_;

        # The SNI string that the client sent:
        #
        my $servername = $sni_cb_ctx->servername();

        # Inform the TLS session accordingly:
        #
        $sni_cb_ctx->set_own_key_and_certs( .. );
        $sni_cb_ctx->set_ca_chain( .. );
        $sni_cb_ctx->set_authmode( .. );
    },
);

DESCRIPTION

This class defines an object given to servername_cb coderefs (cf. Net::mbedTLS::Server).

METHODS

OBJ->set_authmode( $AUTHMODE )

Unneeded unless you’re verifying the client via a TLS certificate.

Configures verification of the client’s certificate. One of the SSL_VERIFY_* constants.

$name = OBJ->servername()

Returns the servername the client gave in the TLS handshake.

OBJ->set_own_key_and_certs( @KEY_AND_CERTIFICATES )

Sets the key and certificate chain that the TLS server will send to the client.

@KEY_AND_CERTIFICATES should be like the key_and_certs argument to Net::mbedTLS’s create_server() method.

A Net::mbedTLS::X::mbedTLS instance is thrown on failure.