Наконец я могу решить это.Спасибо Джеймс К. Полк за предоставленную мне ссылку.Мой сегмент кода указан ниже, а ссылка InsecureSHA1PRNGKeyDerivator - this .Надеюсь, это поможет вам, ребята.
public byte[] decodeFile(byte[] fileData) throws Exception
{
SecretKey insecureKey = deriveKeyInsecurely("password", 16);
byte[] decryptedData = decryptData(fileData, insecureKey);
return decryptedData;
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
private static SecretKey deriveKeyInsecurely(String password, int
keySizeInBytes) throws Exception {
byte[] passwordBytes = password.getBytes(StandardCharsets.US_ASCII);
return new SecretKeySpec( InsecureSHA1PRNGKeyDerivator.deriveInsecureKey( passwordBytes, keySizeInBytes), "AES");
}
private static byte[] decryptData(
byte[] data, SecretKey key) {
try {
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, key );
return cipher.doFinal(data);
} catch (GeneralSecurityException e) {
throw new RuntimeException("This is unconceivable!", e);
}
}