Name

SPVM::Net::SSLeay::SSL_CTX - SSL_CTX data structure in OpenSSL

Description

Net::SSLeay::SSL_CTX class in SPVM represents SSL_CTX data structure in OpenSSL.

Usage

use Net::SSLeay::SSL_CTX;

Fields

Class Methods

new

static method new : Net::SSLeay::SSL_CTX ($method : Net::SSLeay::SSL_METHOD);

Calls native SSL_CTX_new function given the pointer value of $method, creates a new Net::SSLeay::SSL_CTX object, sets the pointer value of the new object to the return value of the native function, and returns the new object.

SSL_MODE_AUTO_RETRY mode is enabled.

Exceptions:

If SSL_CTX_new failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

Instance Methods

get_mode

method get_mode : long ();

Calls native SSL_CTX_get_mode function given the pointer value of the instance, and returns its return value.

set_mode

method set_mode : long ($mode : long);

Calls native SSL_CTX_set_mode function given the pointer value of the instance, $mode, and returns its return value.

get0_param

method get0_param : Net::SSLeay::X509_VERIFY_PARAM ();

Calls native SSL_CTX_get0_param function, creates a Net::SSLeay::X509_VERIFY_PARAM object, sets the pointer value of the new object to the return value of the native function, and returns the new object.

load_verify_locations

method load_verify_locations : int ($CAfile : string, $CApath : string);

Calls native SSL_CTX_load_verify_locations function given the pointer value of the instance, $CAfile, $CApath, and returns its return value.

Exceptions:

If SSL_CTX_load_verify_locations failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

set_default_verify_paths

method set_default_verify_paths : int ();

Calls native set_default_verify_paths function, and returns its return value.

Exceptions:

If SSL_CTX_set_default_verify_paths failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

set_default_verify_paths_windows

method set_default_verify_paths_windows : void ();

It behaves as if "set_default_verify_paths" had been invoked in Windows using the way described below.

https://stackoverflow.com/questions/9507184/can-openssl-on-windows-use-the-system-certificate-store

use_certificate_file

method use_certificate_file : int ($file : string, $type : int);

Calls native use_certificate_file function given the pointer value of the instance, $file, $type, and returns its return value.

Exceptions:

The file $file must be defined. Otherwise an exception is thrown.

If SSL_CTX_use_certificate_file failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

use_certificate_chain_file

method use_certificate_chain_file : int ($file : string);

Calls native use_certificate_chain_file function given the pointer value of the instance, $file, and returns its return value.

Exceptions:

If SSL_CTX_use_certificate_chain_file failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

use_PrivateKey_file

method use_PrivateKey_file : int ($file : string, $type : int);

Calls native use_PrivateKey_file function given the pointer value of the instance, $file, $type, and returns its return value.

Exceptions:

The file $file must be defined. Otherwise an exception is thrown.

If SSL_CTX_use_PrivateKey_file failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

use_PrivateKey

method use_PrivateKey : int ($pkey : Net::SSLeay::EVP_PKEY);

Calls native SSL_CTX_use_PrivateKey function given the pointer value of the instance, $pkey, pushes $pkey to the end of "pkeys_list" field, and returns the return value of the native function.

set_cipher_list

method set_cipher_list : int ($str : string);

Calls native set_cipher_list function given the pointer value of the instance, $str, and returns its return value.

Exceptions:

The cipher list $str must be defined. Otherwise an exception is thrown.

If SSL_CTX_set_cipher_list failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

set_ciphersuites

method set_ciphersuites : int ($str : string);

Calls native set_ciphersuites function given the pointer value of the instance, $str, and returns its return value.

Exceptions:

The ciphersuites $str must be defined. Otherwise an exception is thrown.

If SSL_CTX_set_ciphersuites failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

get_cert_store

method get_cert_store : Net::SSLeay::X509_STORE ();

Calls native SSL_CTX_set_cert_store function, creates a new Net::SSLeay::X509_STORE, sets the pointer value of the new object to the return value of the native function, and returns the new object.

set_options

method set_options : long ($options : long);

Calls native set_options function given the pointer value of the instance, $options, and returns its return value.

get_options

method get_options : long ();

Calls native SSL_CTX_get_options function, and returns its return value.

clear_options

method clear_options : long ($options : long);

Calls native SSL_CTX_clear_options function given the pointer value of the instance, $options, and returns its return value.

set_alpn_protos

method set_alpn_protos : int ($protos : string, $protos_len : int = -1);

Calls native SSL_CTX_set_alpn_protos function given the protocals $ptotos and the length $protos_len, and returns its return value.

If $protos_len is less than 0, it is set to the length of $protos.

Exceptions:

The protocols $protos must be defined. Otherwise an exception is thrown.

If SSL_CTX_set_alpn_protos failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

set1_groups_list

method set1_groups_list : int ($list : string);

Calls native SSL_CTX_set1_groups_list function given the group list $list, and returns its return value.

Exceptions:

The group list $list must be defined. Otherwise an exception is thrown.

If set1_groups_list failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

set_post_handshake_auth

method set_post_handshake_auth : void ($val : int);

Calls native SSL_CTX_set_post_handshake_auth function given the pointer value of the instance, $val.

set_min_proto_version

method set_min_proto_version : int ($version : int);

Calls native SSL_CTX_set_min_proto_version function given the pointer value of the instance, $version, and returns its return value.

Exceptions:

If SSL_CTX_set_min_proto_version failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

set_client_CA_list

method set_client_CA_list : void ($list : X509_NAME[]);

Calls native SSL_CTX_set_client_CA_list function given the pointer value of the instance, $list.

Exceptions:

The list $list must be defined. Otherwise an exception is thrown.

add_client_CA

method add_client_CA : int ($cacert : Net::SSLeay::X509);

Calls native SSL_CTX_add_client_CA function given the pointer value of the instance, $cacert, and returns its return value.

Exceptions:

The X509 object $cacert must be defined. Otherwise an exception is thrown.

If add_client_CA failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

add_extra_chain_cert

method add_extra_chain_cert : long ($x509 : Net::SSLeay::X509);

Calls native SSL_CTX_add_extra_chain_cert function given the pointer value of the instance, $x509, sets the no_free flag of $x509 is set to 1, and returns its return value.

Exceptions:

The X509 object $x509 must be defined. Otherwise an exception is thrown.

If SSL_CTX_add_extra_chain_cert failed, an exception is thrown with eval_error_id set to the basic type ID of Net::SSLeay::Error class.

set_verify

method set_verify : void ($mode : int, $verify_callback : Net::SSLeay::Callback::Verify = undef);

Calls native SSL_CTX_set_verify function given the pointer value of the instance, $mode, $verify_callback.

set_alpn_select_cb

method set_alpn_select_cb : void ($cb : Net::SSLeay::Callback::AlpnSelect, $arg : object);

Calls native SSL_CTX_set_alpn_select_cb function given $cb, $arg.

set_alpn_select_cb_with_protocols

method set_alpn_select_cb_with_protocols : void ($protocols : string[]);

Calls native SSL_CTX_set_alpn_select_cb function defined to select $protocols.

set_default_passwd_cb

method set_default_passwd_cb : void ($cb : Net::SSLeay::Callback::PemPassword, $arg : object = undef);

Calls native SSL_CTX_set_default_passwd_cb function given $cb, and returns its return value.

$arg is expected to be passed to native SSL_CTX_set_default_passwd_cb_userdata function.

set_tlsext_servername_callback

method set_tlsext_servername_callback : long ($cb : Net::SSLeay::Callback::TlsextServername, $arg : object = undef);

Calls native SSL_CTX_set_tlsext_servername_callback function given $cb, and returns its return value.

$arg is expected to be passed to native SSL_CTX_set_tlsext_servername_arg function.

DESTROY

method DESTROY : void ();

Calls native SSL_CTX_free function given the pointer value of the instance if no_free flag of the instance is not a true value.

See Also

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License