Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Signature

 
aymane chetibi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I have a String to which I want to assign a unique signature, then later check to see if that signature corresponds to that string or not.
I want to put everything in a URL.(say the string and its signature) so that when user click, I retrieve string + signature and see if this signature corresponds to that string.

I tried using this:


Do you know once we have the signature how can we chek that a string S corresponds to that signature ?
I also tried to use DSA encryption but to decrypte the signature you have to have the public key which I don't think is possible to put in a URL.

Please help.

Thank you.
 
Henry Wong
author
Marshal
Pie
Posts: 21123
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, this line won't work...



If I remember correctly, the toString() method of an array gives an "L", followed by the class name, followed by some reference number. It doesn't use the contents of the array to generate the string.

Another issue is that the md5 hash is binary -- it is not human readable, which is what you need to be part of a URL. You need some way to encode a string based on the bytes. Try google for either uuencode or base64 encode of java strings, for more information.

But to answer your question...


Do you know once we have the signature how can we chek that a string S corresponds to that signature ?
I also tried to use DSA encryption but to decrypte the signature you have to have the public key which I don't think is possible to put in a URL.


There is no way to convert an md5 hash back to the original string.

To confirm a signature, regenerate another signature from the string S (using the exact same md5 and base64 encoding). If the signature do not match the one recieved, then either the string or signature got corrupted in transit.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic