我怎样才能解密在iOS的XML文件与AES / CBC / PKCS5Padding标准,在Android的文件已被解密,所有的关键像盐,IV

private static Cipher getCipher(int mode) throws Exception { Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding"); //a random Init. Vector. just for testing byte[] iv = "e675f725e675f725".getBytes("UTF-8"); c.init(mode, generateKey(), new IvParameterSpec(iv)); return c; } private static String Decrypt(String encrypted) throws Exception { byte[] decodedValue = new Base64().decode(encrypted.getBytes("UTF-8")); // new BASE64Decoder().decodeBuffer(encrypted); Cipher c = getCipher(Cipher.DECRYPT_MODE); byte[] decValue = c.doFinal(decodedValue); return new String(decValue); } private static Key generateKey() throws Exception { SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); char[] password = "3x5FBNs!".toCharArray(); byte[] salt = "S@1tS@1t".getBytes("UTF-8"); KeySpec spec = new PBEKeySpec(password, salt, 65536, 128); SecretKey tmp = factory.generateSecret(spec); byte[] encoded = tmp.getEncoded(); return new SecretKeySpec(encoded, "AES"); } 

我试图使用RNCryptor,但无法解密。 任何人都可以帮助我使用哪个库,因为我已经得到了encryption文件,不知道它是如何encryption的。

为了使用RNCryptor,最好在两个平台上使用它。

从以前的问题看来,encryption数据似乎是字节,而不是Base64编码。

Apple Common Crypto提供的原语是Security.framework的一部分。 要使用的头文件是#import <CommonCrypto/CommonCrypto.h> ,您将在CommonCryptor.hCommonKeyDerivation.hfind所需的接口。

尝试iOS并添加代码以及所有input和输出参数和数据的hex转储,这两个代码都是Android和iOS代码。