Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* * Copyright (c) Ewoosoft Co., Ltd. * * All rights reserved. */ namespa..
Decoded Output download
<?php
/*
* Copyright (c) Ewoosoft Co., Ltd.
*
* All rights reserved.
*/
namespace Ewoosoft\Crypto; require_once APPPATH . "/../vendor/autoload.php"; require_once APPPATH . "libraries/VTCryptoWrapper.php"; use Ewoosoft\Crypto\ICryptoClassFactory; use Ewoosoft\Crypto\IAESCryptoEngine; use Ewoosoft\Crypto\AESProperties; use Ewoosoft\Crypto\CipherMode; use Ewoosoft\Crypto\ChunkSize; use Ewoosoft\Crypto\VTCryptoError; use CryptoUtils; class VTPhpseclibCryptoClassFactory implements ICryptoClassFactory { public function newAESEngine() { return new VTPhpseclibAESEngine(); } } class VTPhpseclibAESEngine implements IAESCryptoEngine { private $properties; private $key; private $iv; private function getCipherMode(AESProperties $properties) { if ($properties->cipherMode == CipherMode::CBC) { if ($properties->keySize == ChunkSize::e128bits) { return new \phpseclib\Crypt\AES(); } else { if ($properties->keySize == ChunkSize::e256bits) { return new \phpseclib\Crypt\Rijndael(); } else { vt_loge("Unsupported cipher mode: " . $properties->cipherMode); throw new \InvalidArgumentException("Unsupported cipher mode: " . $properties->cipherMode); } } } else { vt_loge("Unsupported cipher mode: " . $properties->cipherMode); throw new \InvalidArgumentException("Unsupported cipher mode: " . $properties->cipherMode); } } public function decrypt($cipher, &$plain) { try { $cipher_mode = $this->getCipherMode($this->properties); $cipher_mode->setBlockLength($this->properties->blockSize); $cipher_mode->setKey($this->key); $cipher_mode->setIV($this->iv); $cipher_mode->disablePadding(); $plain = $cipher_mode->decrypt($cipher); $unpadded = CryptoUtils::unpad($plain, $this->properties->paddingMode, $this->properties->blockSize); $plain = $unpadded; } catch (Exception $e) { vt_loge("Error in decrypt: " . $e); return VTCryptoError::VERR_CRYPTO_ERROR; } return VTCryptoError::VERR_CRYPTO_SUCCESS; } public function encrypt($plain, &$cipher) { $padded = CryptoUtils::pad($plain, $this->properties->paddingMode, $this->properties->blockSize); try { $cipher_mode = $this->getCipherMode($this->properties); $cipher_mode->setBlockLength($this->properties->blockSize); $cipher_mode->setKey($this->key); $cipher_mode->setIV($this->iv); $cipher_mode->disablePadding(); $cipher = $cipher_mode->encrypt($padded); } catch (Exception $e) { vt_loge("Error in encrypt: " . $e); return VTCryptoError::VERR_CRYPTO_ERROR; } return VTCryptoError::VERR_CRYPTO_SUCCESS; } public function setIV($iv) { $this->iv = $iv; } public function setKey($key) { $this->key = $key; } public function setProperties(AESProperties $properties) { $this->properties = $properties; } }
?>
Did this file decode correctly?
Original Code
<?php
/*
* Copyright (c) Ewoosoft Co., Ltd.
*
* All rights reserved.
*/
namespace Ewoosoft\Crypto; require_once APPPATH . "\x2f\56\56\57\166\x65\156\x64\157\x72\57\141\x75\x74\157\154\157\141\x64\56\x70\x68\160"; require_once APPPATH . "\x6c\x69\x62\x72\141\x72\x69\x65\x73\57\x56\x54\x43\x72\x79\160\x74\157\x57\162\141\x70\160\145\x72\x2e\x70\x68\160"; use Ewoosoft\Crypto\ICryptoClassFactory; use Ewoosoft\Crypto\IAESCryptoEngine; use Ewoosoft\Crypto\AESProperties; use Ewoosoft\Crypto\CipherMode; use Ewoosoft\Crypto\ChunkSize; use Ewoosoft\Crypto\VTCryptoError; use CryptoUtils; class VTPhpseclibCryptoClassFactory implements ICryptoClassFactory { public function newAESEngine() { return new VTPhpseclibAESEngine(); } } class VTPhpseclibAESEngine implements IAESCryptoEngine { private $properties; private $key; private $iv; private function getCipherMode(AESProperties $properties) { if ($properties->cipherMode == CipherMode::CBC) { if ($properties->keySize == ChunkSize::e128bits) { return new \phpseclib\Crypt\AES(); } else { if ($properties->keySize == ChunkSize::e256bits) { return new \phpseclib\Crypt\Rijndael(); } else { vt_loge("\x55\156\x73\x75\x70\160\x6f\x72\164\145\x64\40\143\x69\160\150\x65\x72\x20\155\157\x64\x65\72\x20" . $properties->cipherMode); throw new \InvalidArgumentException("\x55\156\163\165\x70\x70\157\x72\x74\145\x64\x20\143\151\x70\150\x65\162\x20\x6d\157\144\145\72\x20" . $properties->cipherMode); } } } else { vt_loge("\125\156\163\x75\160\160\157\162\164\145\144\x20\x63\151\x70\x68\x65\x72\x20\x6d\157\x64\145\x3a\40" . $properties->cipherMode); throw new \InvalidArgumentException("\x55\x6e\x73\165\x70\160\x6f\x72\x74\x65\x64\x20\143\x69\160\x68\x65\x72\40\155\157\x64\x65\72\x20" . $properties->cipherMode); } } public function decrypt($cipher, &$plain) { try { $cipher_mode = $this->getCipherMode($this->properties); $cipher_mode->setBlockLength($this->properties->blockSize); $cipher_mode->setKey($this->key); $cipher_mode->setIV($this->iv); $cipher_mode->disablePadding(); $plain = $cipher_mode->decrypt($cipher); $unpadded = CryptoUtils::unpad($plain, $this->properties->paddingMode, $this->properties->blockSize); $plain = $unpadded; } catch (Exception $e) { vt_loge("\x45\x72\162\157\x72\40\x69\x6e\40\x64\145\143\162\171\x70\164\72\x20" . $e); return VTCryptoError::VERR_CRYPTO_ERROR; } return VTCryptoError::VERR_CRYPTO_SUCCESS; } public function encrypt($plain, &$cipher) { $padded = CryptoUtils::pad($plain, $this->properties->paddingMode, $this->properties->blockSize); try { $cipher_mode = $this->getCipherMode($this->properties); $cipher_mode->setBlockLength($this->properties->blockSize); $cipher_mode->setKey($this->key); $cipher_mode->setIV($this->iv); $cipher_mode->disablePadding(); $cipher = $cipher_mode->encrypt($padded); } catch (Exception $e) { vt_loge("\x45\x72\162\157\162\40\x69\156\40\145\156\143\162\171\160\x74\72\40" . $e); return VTCryptoError::VERR_CRYPTO_ERROR; } return VTCryptoError::VERR_CRYPTO_SUCCESS; } public function setIV($iv) { $this->iv = $iv; } public function setKey($key) { $this->key = $key; } public function setProperties(AESProperties $properties) { $this->properties = $properties; } }
Function Calls
None |
Stats
MD5 | 2cc2aaa8eea5c9b598136a435dc2702d |
Eval Count | 0 |
Decode Time | 66 ms |