You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=item * client_hello_get1_extensions_present and client_hello_get_extension_order
5547
+
5548
+
B<COMPATIBILITY:> not available in Net-SSLeay-1.92 and before; requires at least OpenSSL 1.1.1pre1, not in LibreSSL
5549
+
5550
+
B<NOTE:> to be used only from a callback set with L<CTX_set_client_hello_cb>.
5551
+
5552
+
Returns a reference to an array holding the numerical value of the TLS extension types in the order they appear in the ClientHello. client_hello_get_extension_order is similar and requires at least OpenSSL 3.2.0, not in LibreSSL.
5553
+
5554
+
my $ref = client_hello_get1_extensions_present($s);
5555
+
# $s - value corresponding to openssl's SSL structure
5556
+
#
5557
+
# returns: an array reference of zero or more extension types or undef on failure
5558
+
5559
+
Example from a TLS 1.3 ClientHello:
5560
+
5561
+
sub client_hello_cb {
5562
+
my ($ssl, $arg) = @_;
5563
+
my $ref = client_hello_get1_extensions_present($ssl);
B<COMPATIBILITY:> not available in Net-SSLeay-1.92 and before; requires at least OpenSSL 1.1.1pre1, not in LibreSSL
5575
+
5576
+
B<NOTE:> to be used only from a callback set with L<CTX_set_client_hello_cb>.
5577
+
5578
+
Returns an extension by type number from the ClientHello.
5579
+
5580
+
my $ref = client_hello_get1_extensions_present($s, $type);
5581
+
# $s - value corresponding to openssl's SSL structure
5582
+
# $type - (integer) extension type number
5583
+
#
5584
+
# returns: zero or more octets of extension contents including extension length, undef if the extension is not present
5585
+
5586
+
Example: Get the value of TLS extension C<supported_versions>. You can use constant C<TLSEXT_TYPE_supported_versions> or 43 directly.
5587
+
5588
+
sub client_hello_cb {
5589
+
my ($ssl, $arg) = @_;
5590
+
my $ext_ver = Net::SSLeay::client_hello_get0_ext($ssl, Net::SSLeay::TLSEXT_TYPE_supported_versions());
5591
+
print unpack('H*', $ext_ver), "\n" if defined $ext_ver;
5592
+
}
5593
+
5594
+
Prints: C<080304030303020301> where the first octet 0x08 is the extension length and the following four 16bit values correspond to TLS versions 1.3, 1.2, 1.1 and 1.0.
0 commit comments