我的android应用程序中有一个文件要上传到服务器。我正在使用JNCryptor进行AES256加密。我的服务器上有RNCryptor-php库,我正在尝试解密该文件,但它无法正确解密。下面是我的代码:
Android:
String password = '12345678901234561234567890123456';
File file = new File(filename);
byte[] originalBytes = FileUtils.readFileToByteArray(file);
byte[] encryptedBytes = new AES256JNCryptor().encryptData(originalBytes, password.toCharArray());
FileUtils.writeByteArrayToFile(file, encryptedBytes);PHP
$password = '12345678901234561234567890123456';
$cryptor = new \RNCryptor\Decryptor();
$decryptedData = $cryptor->decrypt($string, $password);
$handle = fopen($decrypted_filename, "w");
fwrite($handle, $decryptedData);
fclose($handle);任何帮助都将不胜感激!谢谢!
发布于 2016-02-17 13:14:50
这有帮助吗?这里讨论了一些看起来非常相关的代码和逻辑。
https://stackoverflow.com/questions/35448209
复制相似问题