Created
October 8, 2011 23:47
-
-
Save takus/1273072 to your computer and use it in GitHub Desktop.
Execute external openssl command by using IPC::Cmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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