B4J Question Please Help me to convert this fuction in B4J

syerif

Active Member
Licensed User
Longtime User
hi,

i have problem to convert this function to b4j, i have try several tutorial and lib, but still unsuccess...

Decrypt and decompress:
public function stringDecrypt($timestamp, $data){
            $key =  $this->cons_id . $this->secretKey . $timestamp;
            $encrypt_method = 'AES-256-CBC'; // metode enkripsi
            $key_hash = hex2bin(hash('sha256', $key)); // hash
            $iv = substr(hex2bin(hash('sha256', $key)), 0, 16); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning
            $output = openssl_decrypt(base64_decode($data), $encrypt_method, $key_hash, OPENSSL_RAW_DATA, $iv);
            return $output;
        }
        // decompress response
        public function decompress($data){
            include_once 'LZCompressor\LZContext.php';
            include_once 'LZCompressor\LZData.php';
            include_once 'LZCompressor\LZReverseDictionary.php';
            include_once 'LZCompressor\LZString.php';
            include_once 'LZCompressor\LZUtil.php';
            include_once 'LZCompressor\LZUtil16.php';
            return LZCompressor\LZString::decompressFromEncodedURIComponent($data);
        }

best regards
 

maXim

Active Member
Licensed User
Longtime User
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Thanks, for sugestion but i am consume api, so i can not change the method.
And as long as you don't tell us which API of which program you are using, no one can help you. I get the impression that you are using an API from a program such as "lz-string-php". In such a case you need a wrapper library for that specific LZH library. In short, you will have to provide more detailed information before someone can help you.
 
Upvote 0

syerif

Active Member
Licensed User
Longtime User
And as long as you don't tell us which API of which program you are using, no one can help you. I get the impression that you are using an API from a program such as "lz-string-php". In such a case you need a wrapper library for that specific LZH library. In short, you will have to provide more detailed information before someone can help you.
I get that function to decript and decompress result from api result..., and i want to convert that function in b4j format..
 
Upvote 0

syerif

Active Member
Licensed User
Longtime User
I get that function to decript and decompress result from api result..., and i want to convert that function in b4j format..
My current condition, after i get the response from api with httputils libs, i still use that function in php format with send response to my php server to convert api response to readable response.
 
Last edited:
Upvote 0
Top