X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fgroupsecret;a=blobdiff_plain;f=lib%2FApp%2FGroupSecret%2FCrypt.pm;h=a7110f7dbdc7686b2b69cb8827ccd4e6a9ebf91c;hp=90163486fe1db33d8bb520f39d4ef2745ec8c396;hb=cdfc47a7e1357f76047015704ee61fe25d3c8f01;hpb=d2b7194430bfb422a9860c574b80fbfbbaebdf81 diff --git a/lib/App/GroupSecret/Crypt.pm b/lib/App/GroupSecret/Crypt.pm index 9016348..a7110f7 100644 --- a/lib/App/GroupSecret/Crypt.pm +++ b/lib/App/GroupSecret/Crypt.pm @@ -37,10 +37,9 @@ sub generate_secure_random_bytes { my @cmd = (qw{openssl rand}, $size); - my ($in, $out); - my $pid = open2($out, $in, @cmd); + my $out; + my $pid = open2($out, undef, @cmd); - close($in); waitpid($pid, 0); my $status = $?; @@ -63,10 +62,8 @@ sub read_openssh_public_key { my @cmd = (qw{ssh-keygen -e -m PKCS8 -f}, $filepath); - my ($in, $out); - my $pid = open2($out, $in, @cmd); - - close($in); + my $out; + my $pid = open2($out, undef, @cmd); waitpid($pid, 0); my $status = $?; @@ -141,10 +138,8 @@ sub decrypt_rsa { my @cmd = (qw{openssl rsautl -decrypt -oaep -in}, $filepath, '-inkey', $privkey); push @cmd, ('-out', $outfile) if $outfile; - my ($in, $out); - my $pid = open2($out, $in, @cmd); - - close($in); + my $out; + my $pid = open2($out, undef, @cmd); waitpid($pid, 0); my $status = $?; @@ -189,10 +184,8 @@ sub encrypt_rsa { my @cmd = (qw{openssl rsautl -encrypt -oaep -pubin -inkey}, $keypath, '-in', $filepath); push @cmd, ('-out', $outfile) if $outfile; - my ($in, $out); - my $pid = open2($out, $in, @cmd); - - close($in); + my $out; + my $pid = open2($out, undef, @cmd); waitpid($pid, 0); my $status = $?;