Esempio n. 1
0
 private function desencapsular($xml)
 {
     $encapsulado = $xml->datos;
     if (strlen($encapsulado) > 0) {
         $char .= "";
         for ($i = 0; $i < strlen($encapsulado); $i = $i + 2) {
             $caracter = chr(hexdec(substr($encapsulado, $i, 2)));
             $char .= substr($caracter, strlen($caracter) - 2);
         }
         $key = md5("Kojoruq1999789po");
         $iv = "dasdREWTRB0098gt";
         $AES = new AES_Encryption($key, $iv);
         $encapsulado = $AES->decrypt($char);
         $dom = new DOMDocument();
         $dom->loadXML($encapsulado);
         $xml_desencapsulado = simplexml_import_dom($dom);
         return $xml_desencapsulado;
     } else {
         return $xml;
     }
 }
Esempio n. 2
0
File: mics.php Progetto: hung5s/yap
function aesDecrypt($data, $encode = 'url')
{
    if ($data == CPropertyValue::ensureInteger($data) . '') {
        //xmail('Decrypting data which is not encrypted', app()->request->requestUri, SETTINGS_DEV_EMAILS);
        return $data;
    }
    $key = hasParam('SETTINGS_AES_ENCRYPT_IV', 'aninditioncmskey');
    Yii::import('Xpress.extensions.vendors.encryption.AES_Encryption');
    $aes = new AES_Encryption(hasParam('SETTINGS_AES_ENCRYPT_KEY', '5682825638385896'), $key);
    switch ($encode) {
        case 'url':
            $data = base64_decode(strtr($data, array('-' => '+', '_' => '/')));
            break;
        case 'base64':
            $data = base64_decode($data);
            break;
    }
    return $aes->decrypt($data);
}
 /**
  * Decrypt a value encyrpted using AES 256 encryption in CBC mode.
  * 
  * @param  string $value Value to be decrypted
  * @return string Decrypted value.
  */
 public function decrypt($value)
 {
     $AES = new AES_Encryption($this->algorithm_key, $this->algorithm_iv);
     return $AES->decrypt(base64_decode($value));
 }