GettingSignals

[Android]AES復号化処理でBadPaddingException

2012年11月17日
Posted by hina

サーバで暗号化した文字列を
アプリで復号化しようとした際にはまったので、メモ。

SecretKey key = new SecretKeySpec(key, “AES”);
Cipher cipher = Cipher.getInstance(“AES/ECB/PKCS5Padding”);
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] encrpytText = cipher.doFinal(encryptCode);

最後のdoFinal()で
BadPaddingException: pad block corrupted.

が発生します。

そんなあなたに、

暗号化キーと復号化キーは同じですか?

http://stackoverflow.com/questions/12110459/android-des-decrypt-badpaddingexception-pad-block-corrupted

Share

Comments are currently closed.

Follow

カレンダー

2024年5月
 12345
6789101112
13141516171819
20212223242526
2728293031