String byteString = bytAr.toString;
byte[] retByteAr = byteString. getBytes("UTF-8");
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
bytAr.toString
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
First Set:
Input: [B@ffed4784
Output: [B@1fb15e
Second Set:
Input: [B@49ea68f
Output: [B@1c968f
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
Partheban Udayakumar wrote:Ulf,
I checked with the random generated inputs, they are different but the encoder always gives the same encode and the decoded output is also different but it is shortened by one or two characters.
First Set:
Input: [B@ffed4784
Output: [B@1fb15e
Second Set:
Input: [B@49ea68f
Output: [B@1c968f
Richard,
Can you enlighten me on ASCii85 encoders and decoders? Have you used it in JME?
Partheban Udayakumar wrote:I checked with the random generated inputs, they are different but the encoder always gives the same encode and the decoded output is also different but it is shortened by one or two characters.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
Partheban Udayakumar wrote:
Partheban Udayakumar wrote:Ulf,
I am generating AES key in my server (because I couldn't generate it in JME which is due to the absence of Secure Random class) and sending it to client to encrypt the data. Then I send back the key and encrypted message to store it in a database which can be retrieved by the receiver to decrypt the message.
I solved the key transfer problem
but the problem now in hand is, I store the received message in a vector, the only collection I could find in JME. Now I cannot convert the object which it returns to an byte array. I tried using ObjectOutputStream to convert it to byte[] but it is not available in JME.
Richard Tookey wrote:
So you are still sending the key over an insecure channel!
Richard Tookey wrote:
If you are sending the key over an insecure channel you have most definitely not solved the transfer problem!
Richard Tookey wrote:
I would say to use DataOutputStream but since the whole approach is just plain wrong I won't !
Ulf Dittmer wrote:
It seems we've gone over all this before; Arrays.toString is not the way to convert binary data to strings
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
Partheban Udayakumar wrote:
Richard Tookey wrote:
So you are still sending the key over an insecure channel!
I am using HTTPS channel to transfer data.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
Partheban Udayakumar wrote: What if I want to convert a byte[] to String without encoding?
Often the most important part of the news is what they didn't tell.
Partheban Udayakumar wrote:My client wants it. I don't know for what reasons. But he still says he wants it.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Partheban Udayakumar wrote:Richard,
My client wants it. I don't know for what reasons. But he still says he wants it.
Do you have any ideas on how to retrieve the byte[] stored in a db. I used the following code:
On printing, it shows [0,0,0,0....]
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
--- Martin Fowler
Partheban Udayakumar wrote:Richard,
I am sorry but I can't talk to my clients my management does that. My management wants me to use http with AES Encryption. What can I do? I am a fresher as you say and I have no control over it. I am sorry. Let's get to the problem please. Please help me get this.
byte[] a = {} ;
is.read(a,0,a.length);
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|