Files
webgui/emhttp/plugins/dynamix/scripts/open_ssl
2025-02-12 03:09:28 +01:00

29 lines
928 B
PHP
Executable File

#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2025, Lime Technology
* Copyright 2012-2025, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$ssl_input = '/etc/rc.d/rc.ssl.input';
if (is_readable($ssl_input)) extract(parse_ini_file($ssl_input));
switch ($argv[1]) {
case 'encrypt':
if (!empty($argv[2]) && isset($cipher,$key,$iv)) $encrypt = openssl_encrypt($argv[2],$cipher,$key,0,$iv);
if (!empty($encrypt)) echo "$encrypt";
break;
case 'decrypt':
if (!empty($argv[2]) && isset($cipher,$key,$iv)) $decrypt = openssl_decrypt($argv[2],$cipher,$key,0,$iv);
if (!empty($decrypt)) echo "$decrypt";
break;
}
?>