Crypt-MatrixSSL3

 view release on metacpan or  search on metacpan

t/06.client_server.t  view on Meta::CPAN

    'got some outbuf (client)';
$tmp = $client2server;
ok $Client_SSL->encode_to_outdata($s) > 0,
    '$Client_SSL->encode_to_outdata';
is undef, _decode($Client_SSL, $server2client, $client2server);
ok length $tmp < length $client2server,
    'outbuf grow (client)';

is undef, _decode($Server_SSL, $client2server, $server2client, $buf);
is $buf, $s.$s,
    'decoded ok (server)';
ok !length $client2server,
    'outbuf empty (client)';
ok !length $server2client,
    'outbuf empty (server)';

# SSL_MAX_PLAINTEXT_LEN

$s = 'abc' x 123456;
$tmp = $s;
$buf = q{};

t/06.client_server.t  view on Meta::CPAN

    ok $Client_SSL->encode_to_outdata(substr($tmp, 0, SSL_MAX_PLAINTEXT_LEN, q{})) > 0,
        'encode_to_outdata up to SSL_MAX_PLAINTEXT_LEN (client)';
}
    is undef, _decode($Client_SSL, $server2client, $client2server),
        'encoding';
while (length $client2server) {
    is undef, _decode($Server_SSL, $client2server, $server2client, $buf),
        'decoding';
}
ok $buf eq $s,
    'string split into SSL_MAX_PLAINTEXT_LEN chains decoded ok';
ok !length $client2server,
    'outbuf empty (client)';
ok !length $server2client,
    'outbuf empty (server)';

# More than SSL_MAX_PLAINTEXT_LEN

#$s = 'x' x (SSL_MAX_PLAINTEXT_LEN+1);
#is $Client_SSL->encode_to_outdata($s), PS_LIMIT_FAIL,
#    'encode_to_outdata SSL_MAX_PLAINTEXT_LEN+1 failed';

t/leak.t  view on Meta::CPAN


    my $buf;

    $Client_SSL->encode_to_outdata($client_server_s) > 0
        or die 'encode_to_outdata';
    $Client_SSL->encode_to_outdata($client_server_s) > 0
        or die 'encode_to_outdata';
    assert _decode($Client_SSL, $server2client, $client2server);
    assert _decode($Server_SSL, $client2server, $server2client, $buf);
    $buf eq $client_server_s . $client_server_s
        or die 'packets 1+2 decoded incorrectly';

    $Client_SSL->encode_to_outdata($client_server_s16k) > 0
        or die 'encode_to_outdata';
    $Client_SSL->encode_to_outdata($client_server_s16k) > 0
        or die 'encode_to_outdata';
    assert _decode($Client_SSL, $server2client, $client2server);
    assert _decode($Server_SSL, $client2server, $server2client, $buf);
    $buf eq $client_server_s . $client_server_s . $client_server_s16k
        or die 'packet 3 decoded incorrectly';
    assert _decode($Client_SSL, $server2client, $client2server);
    assert _decode($Server_SSL, $client2server, $server2client, $buf);
    $buf eq $client_server_s . $client_server_s . $client_server_s16k . $client_server_s16k
        or die 'packet 4 decoded incorrectly';

    undef $client2server;
    undef $server2client;
    undef $client_rc;
    undef $server_rc;
    undef $buf;
    undef $Client_SSL;
    undef $Server_SSL;
}

t/matrixSslEncodeClosureAlert.t  view on Meta::CPAN

ok $Client_SSL->encode_to_outdata($s) > 0,
    'encode_to_outdata (client)';
is $tmp, $s,
    q{encode_to_outdata doesn't destroy input string};
is undef, _decode($Client_SSL, $server2client, $client2server);
ok length $client2server,
    'got some outbuf (client)';

is undef, _decode($Server_SSL, $client2server, $server2client, $buf);
is $buf, $s,
    'decoded ok (server)';
ok !length $client2server,
    'outbuf empty (client)';
ok !length $server2client,
    'outbuf empty (server)';

# ClosureAlert

is MATRIXSSL_SUCCESS, $Client_SSL->encode_closure_alert(),
    'encode_closure_alert';

t/matrixSslEncodeRehandshake.t  view on Meta::CPAN

    is undef, _decode($Client_SSL, $server2client, $client2server);
    ok length $client2server,
        'got some outbuf (client)';

    my $is_plaintext = $client2server =~ /\Q$s\E/;
    is $is_plaintext, $plaintext,
        'ssl'.($plaintext ? ' NOT ' : ' ').'encrypted';

    is undef, _decode($Server_SSL, $client2server, $server2client, $buf);
    is $buf, $s,
        'decoded ok (server)';
    ok !length $client2server,
        'outbuf empty (client)';
    ok !length $server2client,
        'outbuf empty (server)';
}

sub fin {
    undef $Server_SSL;
    undef $Client_SSL;
    undef $Server_Keys;



( run in 0.930 second using v1.01-cache-2.11-cpan-26ccb49234f )