Skip to content

Instantly share code, notes, and snippets.

@takus
Created October 8, 2011 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takus/1273072 to your computer and use it in GitHub Desktop.
Save takus/1273072 to your computer and use it in GitHub Desktop.
Execute external openssl command by using IPC::Cmd
use IPC::Cmd qw/can_run run/;
our $OPENSSL = can_run('openssl') or die 'openssl is not installed!';
my $ok = run(
verbose => 0,
command => [
"openssl", "enc",
"-e", "-aes256",
"-in", $input,
"-out", $output,
"-pass", "pass:$password"
],
buffer => \my $buf,
timeout => 300,
);
unless ($ok) {
croak "encrypt failed: $buf";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment