Ignore:
Timestamp:
Jul 7, 2016, 1:51:54 PM (5 years ago)
Author:
joamuran
Message:

Encrypting credentials

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin-center/trunk/fuentes/admin-center.install/usr/share/admin-center/n4d.php

    r2002 r2115  
    2929}
    3030
     31
     32function n4dRSADecrypt($crypttext){
     33  $priv_key = openssl_pkey_get_private("file:///etc/admin-center/private_key.pem");
     34  openssl_private_decrypt(base64_decode($crypttext), $newsource, $priv_key );
     35 
     36  return $newsource;
     37}
     38
    3139function n4d($method, $args, $timeout){
     40  writeHeader();
    3241 
    33   writeHeader();
    3442  $url='https://127.0.0.1:9779';
    3543  $request=xmlrpc_encode_request($method, $args);
     
    98106// Getting $_POST parameters
    99107  $method=$_POST["method"];
    100   $args=json_decode($_POST["args"]);
     108 
     109  //error_log($_POST["args"]);
     110  //error_log($_POST["args"]);
     111 
     112  $args_coded=n4dRSADecrypt($_POST["args"]);
     113  error_log("eeeeeeeeeeeeeeeee");
     114  error_log($args_coded);
     115  $args=json_decode($args_coded);
     116  if (gettype($args)=="NULL") $args=array();
     117 
    101118  $timeout=$_POST["timeout"];
    102   $myfile = fopen("/tmp/n4dlog","a");
     119  /*$myfile = fopen("/tmp/n4dlog","a");
     120  fwrite($myfile,"\nMETHOD:\n");
    103121  fwrite($myfile,$method);
     122  fwrite($myfile,"\nARGS IN POST:\n");
    104123  fwrite($myfile,$_POST["args"]);
    105   fwrite($myfile,"******\n");
     124 
     125  fwrite($myfile,"\nTYPE ARGS IN POST:\n");
     126  fwrite($myfile, gettype($_POST["args"]));
     127 
     128  fwrite($myfile,"\nARGS CODED:\n");
     129  fwrite($myfile, $args_coded);
     130 
     131  fwrite($myfile,"\nTYPE ARGS CODED:\n");
     132  fwrite($myfile, gettype($args_coded));
     133 
     134  fwrite($myfile,"\nARGS DECODED:\n");
     135  fwrite($myfile, $args);
     136  fwrite($myfile,"\nARGS DECODED TYPE:\n");
     137  fwrite($myfile, gettype($args));
     138 
     139  fwrite($myfile,"******\n\n");
    106140  fclose($myfile);
    107141  error_log($method);
     142  */
    108143 
    109144  if (isset($_POST['log'])) $log=$_POST["log"];
Note: See TracChangeset for help on using the changeset viewer.