Closed ykw090721 closed 3 years ago
@ykw090721, please provide example code which describes your use case at best. @MST1122 can you look at this?
The problem is solved, I just call gzdecode after decrypting the data, but it didn’t work before
问题解决了,我只是在解密数据后调用gzdecode,但是之前没有用
` public function downloadFeedProcessingReport($payload) { $encryptionDetails = $payload['encryptionDetails']; $feedDownloadUrl = $payload['url']; $key = $encryptionDetails['key']; $initializationVector = $encryptionDetails['initializationVector'];
// base64 decode before using in encryption
$initializationVector = base64_decode($initializationVector, true);
$key = base64_decode($key, true);
$decryptedFile = ASECryptoStream::decrypt(file_get_contents($feedDownloadUrl), $key, $initializationVector);
if($payload['compressionAlgorithm']=='GZIP') {
$decryptedFile=gzdecode($decryptedFile);
}
$decryptedFile = preg_replace('/\s+/S', " ", $decryptedFile);
$xml = simplexml_load_string($decryptedFile);
$json = json_encode($xml);
return json_decode($json, TRUE);
}`
Should be this
After I call ASECryptoStream::decrypt to decrypt the data, the returned data is garbled. I tried gzip decompression and conversion of the encoding type, but it can’t solve this problem. Have you encountered this problem?