bin - Add script to encrypt/decrypt file
authorPeng Li <seudut@gmail.com>
Wed, 8 Mar 2017 15:20:59 +0000 (23:20 +0800)
committerPeng Li <seudut@gmail.com>
Wed, 8 Mar 2017 15:20:59 +0000 (23:20 +0800)
bin/filedec [new file with mode: 0755]
bin/fileenc [new file with mode: 0755]

diff --git a/bin/filedec b/bin/filedec
new file mode 100755 (executable)
index 0000000..fa0ad30
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/perl -w
+#
+use strict;
+
+#https://www.madboa.com/geek/openssl/#how-do-i-create-an-md5-or-sha1-digest-of-a-file
+#
+# encrypt the file using 256-bit AES in CBC mode
+# 
+# Usage: filedec inFile <outFile>
+#
+my $inFile  = shift or die "Usage: $0 in_file <out_file>\n";
+my $outFile = shift || "";
+
+my $command = "openssl enc -d -aes-256-cbc -in $inFile " .  ($outFile && "-out $outFile");
+print `$command`;
diff --git a/bin/fileenc b/bin/fileenc
new file mode 100755 (executable)
index 0000000..0907601
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/perl -w
+#
+use strict;
+
+#https://www.madboa.com/geek/openssl/#how-do-i-create-an-md5-or-sha1-digest-of-a-file
+#
+# encrypt the file using 256-bit AES in CBC mode
+# 
+# Usage: fileenc inFile <outFile>
+
+my $inFile  = shift or die "Usage: $0 in_file <out_file>\n";
+my $outFile = shift || "";
+
+my $command = "openssl enc -aes-256-cbc -salt -in $inFile " . ($outFile && "-out $outFile");
+print $command;