how to send a digital signature across sockets ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • itcoll
    New Member
    • Nov 2008
    • 3

    how to send a digital signature across sockets ?

    i have wriiten java code for client server communication - the client sends a digital signature and the server verifies it using the public key .I have sent the signature as a string from the client to server.although the verification comes as true most of the times , some times it comes as "false" .i dont know why it comes that way .

    so my question is ::: is there any problem in sending the digital signature as a string. if so , then how can i send it across sockets ?

    i have used the necessary specs [ X509EncodedKeyS pec , PKCS8EncodedKey Spec ] to write and read the private , public keys.so i dont think its a problem with the keys .

    thank you :)
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Sockets just read and write bytes through their Streams. Everything else is your responsibility; luckily enough the entire IO library is written as a bunch of wrappers so you can send anything you want over those wires.

    kind regards,

    Jos

    Comment

    • pronerd
      Recognized Expert Contributor
      • Nov 2006
      • 392

      #3
      Originally posted by itcoll
      i have wriiten java code for client server communication - the client sends a digital signature and the server verifies it using the public key
      There are existing API's for setting up secure communications that handle all of these details for you so you do not have to get hung up on these types of low level details.



      Originally posted by itcoll
      is there any problem in sending the digital signature as a string.
      Yes. Strings only support the ASCII character sets with some additional encoding charters. Your encryption keys are very likely to contain charters that are not part of the supported data sets in a String object. You will probably need to use a character array to send the key to ensure it is not modified.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by pronerd
        Yes. Strings only support the ASCII character sets with some additional encoding charters.
        1s/ASCII/Unicode/

        kind regards,

        Jos

        Comment

        Working...