Sally Molloy

Greenhorn
+ Follow
since Mar 01, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sally Molloy

Yeah sorry - the code is pretty horrendous but as I said I am not a Java programmer and everytime I tried to tidy anything up it seemed to produce compile errors!!!

Anyway, the 00 or nulls thing is the encoding that has been specified. I have to send out certain composite data made up of different sections. Two 00s (i.e. 00 00) indicates the end of a section and is meant to allow the recipient to parse it. Now there is the obvious problem that if the data contains an actual or "real" 00 you need to escape that. How you do that is you add a 01 after it. So in summary, if you want to write 'end of segment' you write 00 00; if you genuinely want to send 00 as part of the data you ssend 00 01.

This is what all the looping through byte[]s is about . Hopeless???
12 years ago
Thanks for the reply. I am posting the code that calls the code I previously posted. I apologise in advance for posting so much code but I have already illustrated that I am not capable of identifying the relevant code


12 years ago
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)

12 years ago
Hi Jeff, thanks for replying.


I think I have left out some critical points in my explanation of what I am trying to do!
* I have to write to a server thats been provided as an executable so pretty much black box.
* The user is to enter any string when running the client and indicates end of entry by hitting return
* The client is expecting to receive this string as a byte array or byte stream??
* The server is outputting messages like "invalid type 48 in stream, expected 1". In the bit of blurb provided with the server this is listed as a common error and says you are still sending a string, not bytes???

Thanks for the advice onthe exceptions - I have changed that now but I am not seeing any output as I amn't encountering an exception
Hi,
I am a compete greenhorn, no in fact that is probably being a bit generous. I am many years in software but have never even taken a single class in Java, just the way it happened - it didn't come up.
Now I am taking night course in security and the very lazy, arrogant lecturer won't accept the assignments in anything other than Java although "this is not a Java course" as he keeps telling us. So yes people this is homework, just not Java homework.
I need to write a client that takes in user input (string) opens a socket and sends it off as bytes to the server.
Through Googling and general hacking together of examples I have it compiled and talking to the server I was provided with but the server keeps producing an error claiming I am sending ASCII.
Everything I read, including on this site suggests I am sending the string converted to bytes....
Can anyone suggest what is going on??
I am literally begging for help on this one.