Whats the difference between this 2 lines of java code?
byte[] b = byteArrayReturningMethod()
//Essentially converting the byte[] to a string then converting back again
byte[] b = (new String(byteArrayReturningMethod)).getBytes()
Don't worry too much about it for now. Let me share with you a little misadventure I had while trying to implement an encryption system for fresbo world.
Encryption is part of our effort to mark fresbo world as secure as possible. It is straight forward on the client side, especially with the AS3 crypto package. The server however, will need a custom build solution due to design considerations.
After discarding one design and building another from ground up, I finally managed to build one that could successfully communicate with itself. (Through a for loop that transfer byte[] of data from server mode to client mode and back again) I happily proceed to build a simple server (lets call this the java server) and test it over a tcp connection with the flash client. To my extreme puzzlemennt, the server could not complete the pre-encryption handshake with the client. One weird error after another keep poping up.
Sufficent to say that I spent a huge amount of time deploying debug tools, examining the packets sent and pouring over my code without success. When I was on the verge of giving up, it finally occur to me to test my java server with another java client (build using the encryption module) over a socket. The handshake failed again of course, which isolates the problem. The bug must be in the code that send data over the socket. Which lead us back to the top 2 lines of java code.
Being a typical lazy programmer, I download server client code from the net and modify them to work with my encryption module. The read/write are done using a BufferedReader, which work with char[] and strings, so I need to convert between them and byte[] which my module use.
char[] => String => byte[]
During the conversion, unknowingly, the underlying bytes are changed. This change had actually been detected when I do a byte by byte comparison between outputs, but it had been ignored becaue I assumed that those are cased by difference in random seeds. So, never convert from byte[]/char[] into string and back again if you need to preserve your data.
I might post some more on debugging SSL in the future, but thats all for now.
Comments
why points is can't trade now why?
bkit po bigla nalang na hindi na pede i trade yung points
at bkit po nag-disable ung fresbo account
why?
josef_mark@yahoo.com
account;jaison08
Post new comment