X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fgroupsecret;a=blobdiff_plain;f=lib%2FApp%2FGroupSecret%2FCrypt.pm;h=a7110f7dbdc7686b2b69cb8827ccd4e6a9ebf91c;hp=f5360bec464bf120148b056248042db86365bfe5;hb=cdfc47a7e1357f76047015704ee61fe25d3c8f01;hpb=93527579d68b0ccdd5dab72d88764a53fef43b88 diff --git a/lib/App/GroupSecret/Crypt.pm b/lib/App/GroupSecret/Crypt.pm index f5360be..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 = $?; @@ -227,7 +220,7 @@ sub decrypt_aes_256_cbc { $filepath = $temp->filename; } - my @cmd = (qw{openssl aes-256-cbc -d -pass stdin -in}, $filepath); + my @cmd = (qw{openssl aes-256-cbc -d -pass stdin -md sha256 -in}, $filepath); push @cmd, ('-out', $outfile) if $outfile; my ($in, $out); @@ -269,7 +262,7 @@ sub encrypt_aes_256_cbc { $filepath = $temp->filename; } - my @cmd = (qw{openssl aes-256-cbc -pass stdin -in}, $filepath); + my @cmd = (qw{openssl aes-256-cbc -pass stdin -md sha256 -in}, $filepath); push @cmd, ('-out', $outfile) if $outfile; my ($in, $out);