Skip to content

Commit

Permalink
Support for TLS 1.1 and 1.2, default to TLSv1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
retupmoca committed Nov 16, 2015
1 parent 169c6e1 commit 3974a28
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
13 changes: 11 additions & 2 deletions lib/OpenSSL.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,22 @@ method new(Bool :$client = False, Int :$version?) {
when 3 {
$method = ($client ?? OpenSSL::Method::SSLv3_client_method() !! OpenSSL::Method::SSLv3_server_method());
}
default {
when 1 {
$method = ($client ?? OpenSSL::Method::TLSv1_client_method() !! OpenSSL::Method::TLSv1_server_method());
}
when 1.1 {
$method = ($client ?? OpenSSL::Method::TLSv1_1_client_method() !! OpenSSL::Method::TLSv1_1_server_method());
}
when 1.2 {
$method = ($client ?? OpenSSL::Method::TLSv1_2_client_method() !! OpenSSL::Method::TLSv1_2_server_method());
}
default {
$method = ($client ?? OpenSSL::Method::TLSv1_2_client_method() !! OpenSSL::Method::TLSv1_2_server_method());
}
}
}
else {
$method = $client ?? OpenSSL::Method::TLSv1_client_method() !! OpenSSL::Method::TLSv1_server_method();
$method = $client ?? OpenSSL::Method::TLSv1_2_client_method() !! OpenSSL::Method::TLSv1_2_server_method();
}
my $ctx = OpenSSL::Ctx::SSL_CTX_new( $method );
my $ssl = OpenSSL::SSL::SSL_new( $ctx );
Expand Down
30 changes: 18 additions & 12 deletions lib/OpenSSL/Method.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@ class SSL_METHOD is repr('CStruct') {
has int32 $.version;
}

our sub SSLv2_client_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv2_server_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv2_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv3_client_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv3_server_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv3_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv23_client_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv23_server_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv23_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_client_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_server_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv2_client_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv2_server_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv2_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv3_client_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv3_server_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv3_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv23_client_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv23_server_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub SSLv23_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_client_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_server_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_1_client_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_1_server_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_1_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_2_client_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_2_server_method() returns SSL_METHOD is native(&ssl-lib) { ... }
our sub TLSv1_2_method() returns SSL_METHOD is native(&ssl-lib) { ... }

0 comments on commit 3974a28

Please sign in to comment.