Hi, I am completely new to
Java but am posting this here as similar issues seem to have come up here before.
I have STRUGGLED to complete a crypto assignment that has to be handed in in Java though I am not a java programmer. My code now works and implements Otway-Rees
most of the time but then suddenly starts failing with the below exception. Most other reports of this exception I have come across seem to boil down to representing encrypted data as a
string or character and the suggestion is to change it to a byte{] but I am already doing that (I think!!) The exception seems to mainly occur when I am decrypting rather than encrypting but most times it just works. Money on though it will produce the error when handed up to teacher so any and all help greatly appreciated.
javax.crypto.BadPaddingException
at gnu.javax.crypto.jce.cipher.CipherAdapter.engineDoFinal(libgcj.so.11)
at javax.crypto.Cipher.doFinal(libgcj.so.11)
at javax.crypto.Cipher.doFinal(libgcj.so.11)
at MyUtility.decrypt(MyUtility.java:11)
at ClientBOraConnectionHandler.run(ClientB.java:302)
at java.lang.Thread.run(libgcj.so.11)