client.pl:sub server { # my $plaintext = $cipher->decrypt($buf); # my $in = "SERVER: Text: ".$plaintext; # my $ciphertext = $cipher->encrypt($in); # print($new_sock $ciphertext); my $plaintext = decrypt($buf); my $in = "SERVER: Text: ".$plaintext; my $ciphertext = crypt_($in); } sub crypt_ { $cipher->start('encrypting'); print $sock $cipher->crypt($_) while <STDIN>; print $sock $cipher->finish(); } sub decrypt { $cipher->start('decrypting'); local $/ = \4096; process_bytes($cipher->crypt($_)) while <$sock>; process_bytes($cipher->finish()); }
In output from server.pl i have error:if ($kid) { # parent reads from STDIN, prints to socket while (defined($in = <STDIN>)) { # my $ciphertext = $cipher->encrypt($in); # print $ciphertext; # print $sock $ciphertext; my $ciphertext = crypt_($in); } # kill the child process kill(TERM => $kid); } else { # child reads from socket, prints to STDOUT while (defined($buf = <$sock>)) { # my $plaintext = $cipher->decrypt($buf); # print $plaintext; my $plaintext = decrypt($buf); print $plaintext; } close $sock; } sub crypt_ { $cipher->start('encrypting'); print $sock $cipher->crypt($_) while <STDIN>; print $sock $cipher->finish(); } sub decrypt { $cipher->start('decrypting'); local $/ = \4096; process_bytes($cipher->crypt($_)) while <$sock>; process_bytes($cipher->finish()); }
In client.pl again I must clicks enter. How to i can use IO::Socket::SSL ?wmp@innocence:~/ISS/iss/daemon$ ./server.pl Undefined subroutine &main::process_bytes called at ./server.pl line 6 +6. wmp@innocence:~/ISS/iss/daemon$
In reply to Re^2: Crypt::CBC and IO:Socket
by WMP
in thread Crypt::CBC and IO:Socket
by WMP
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |