File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to convert a key to string (like to store it in a file)?

 
harke baj
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

is it possible to convert a key to a string?

like if I want to append a key to a string then encrypt that string and store it in a file.

encrypt_the_main_message ( sub_message + key_converted_2_string)

thanks,

akarsha
 
Pat Farrell
Rancher
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
harke baj wrote:is it possible to convert a key to a string?

like if I want to append a key to a string then encrypt that string and store it in a file.

cipher keys are nearly always defined as vectors of octets, i.e. binary values, 8-bits to a bucket.

They are not Java Strings or even Byte[].

Is it possible? anything is possible. Is it a good idea? that depends on a ton of things outside the scope of your question.

If you have a key and "then encrypt that string" which key are you going to use for the encryption and decryption process?

If you program does not know the key, once it is encrypted and written to a file, how does it use it again, without the key that is in the file?

This quickly gets a lot more complex than you seem to be asking.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic