David McReynolds
2014-08-15 13:15:31 UTC
I am posting this on behalf of a friend. He is using RedHat and the
OpenJDK. The encryption seems to work, but he is getting an error during
the decryption.
Caused by: javax.crypto.IllegalBlockSizeException: last block incomplete in
decryption
at org.bouncycastle.jce.provider.JCEBlockCipher.engineDoFinal(Unknown
Source)
at javax.crypto.Cipher.doFinal(Cipher.java:1813)
I think it is worth mentioning that they error does not occur when running
the same code under an Oracle JVM.
I was just wondering if there was a known issue.
============================
Here's how he is trying to decrypt.
var decryptedString : String = null
try {
if (encryptedText != null) {
var encryptedBytes : byte[] = new
sun.misc.BASE64Decoder().decodeBuffer(encryptedText)
_cipher.get().init(Cipher.DECRYPT_MODE, _keySpec, _ivSpec)
var decrypted : byte[] = _cipher.get().doFinal(encryptedBytes)
decryptedString = new String(decrypted, "UTF8")
}
} catch (ikExc : InvalidKeyException) {
throw ikExc
} catch (iapExc : InvalidAlgorithmParameterException) {
throw iapExc
} catch (ibsExc : IllegalBlockSizeException) {
throw ibsExc
} catch (bpExc : BadPaddingException) {
throw bpExc
}
return decryptedString
OpenJDK. The encryption seems to work, but he is getting an error during
the decryption.
Caused by: javax.crypto.IllegalBlockSizeException: last block incomplete in
decryption
at org.bouncycastle.jce.provider.JCEBlockCipher.engineDoFinal(Unknown
Source)
at javax.crypto.Cipher.doFinal(Cipher.java:1813)
I think it is worth mentioning that they error does not occur when running
the same code under an Oracle JVM.
I was just wondering if there was a known issue.
============================
Here's how he is trying to decrypt.
var decryptedString : String = null
try {
if (encryptedText != null) {
var encryptedBytes : byte[] = new
sun.misc.BASE64Decoder().decodeBuffer(encryptedText)
_cipher.get().init(Cipher.DECRYPT_MODE, _keySpec, _ivSpec)
var decrypted : byte[] = _cipher.get().doFinal(encryptedBytes)
decryptedString = new String(decrypted, "UTF8")
}
} catch (ikExc : InvalidKeyException) {
throw ikExc
} catch (iapExc : InvalidAlgorithmParameterException) {
throw iapExc
} catch (ibsExc : IllegalBlockSizeException) {
throw ibsExc
} catch (bpExc : BadPaddingException) {
throw bpExc
}
return decryptedString
--
--------------
*Mi aerodeslizador está lleno de anguilas.*
--------------
*Mi aerodeslizador está lleno de anguilas.*