aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Signature Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Signature" Watch "Signature" New topic
Author

Signature

aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
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
Sheriff

Joined: Sep 28, 2004
Posts: 18997
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
wood burning stoves
 
subject: Signature