help on encryption key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eyeofsoul
    New Member
    • Sep 2007
    • 31

    help on encryption key

    hello..i have an issue about encryption key.i have generate a key using secretkey, can it be save to a file?!..does the process are just the same like writing a string to a file?!..and then retrieving the key,does it are the same like reading the file?!..
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    Originally posted by eyeofsoul
    hello..i have an issue about encryption key.i have generate a key using secretkey, can it be save to a file?!..does the process are just the same like writing a string to a file?!..and then retrieving the key,does it are the same like reading the file?!..
    Just writing it to a file like writing a String won't work - you'd get the current name of the secretkey-object, but that's it. However, Secretkey has a method called "getEncoded ()" which returns a byte-array. You can save a byte-array to a file (again, don't just print it like a String - you'll get the objects name. Try the Arrays class.) and then read it again from file. You'll have to convert it again, but that's solvable.

    Greetings,
    Nepomuk

    Comment

    • hsn
      New Member
      • Sep 2007
      • 237

      #3
      i think it is the same way as writing a strnig to a text file

      hsn

      Comment

      • drsmooth
        New Member
        • Oct 2007
        • 112

        #4
        also, i have had success using objectOutputStr eam to save a Key object to a file. You can use ObjectInputStre am to lead it up again and cast it back to a Key object.

        Comment

        Working...