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;

Class Methods

new

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

Creates a new Net::SSLeay::SSL_CTX given the Net::SSLeay::SSL_METHOD object $method, and returns the new object.

SSL_MODE_AUTO_RETRY mode is enabled.

Instance Methods

set_mode

method set_mode : long ($mode : long);

Adds the mode $mode by calling SSL_CTX_set_mode function, and returns the updated mode.

set_verify

method set_verify : void ($mode : int);

Sets the verification flags $mode by calling SSL_CTX_set_verify function.

get0_param

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

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

load_verify_locations

method load_verify_locations : int ($path : string);

Specifies the locations, at which CA certificates for verification purposes are located by calling SSL_CTX_load_verify_locations function.

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 ();

Specifies that the default locations from which CA certificates are loaded should be used by calling set_default_verify_paths function.

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.

use_certificate_file

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

Loads the first certificate stored in the file $file and the type $type by calling use_certificate_file function.

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);

Loads a certificate chain from the file $file by calling use_certificate_chain_file function.

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);

Adds the first private key found in the file $file and the type $type by calling use_PrivateKey_file function.

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.

set_cipher_list

method set_cipher_list : int ($str : string);

Sets the list of available ciphers by calling set_cipher_list function.

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);

Configures the available TLSv1.3 ciphersuites by calling set_ciphersuites function.

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 ();

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

set_options

method set_options : long ($options : long);

Adds the options set via bitmask in the options $options by calling set_options function, and returns its return value.

get_options

method get_options : long ();

Returns the options by calling SSL_CTX_get_options function.

clear_options

method clear_options : long ($options : long);

Clears the options set via bit-mask in the options $options by calling SSL_CTX_clear_options function, and returns its return value.

DESTROY

method DESTROY : void ();

Frees SSL_CTX object by calling SSL_CTX_free function if no_free flag of the instance is not a true value.

See Also

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License