aspose file tools*
The moose likes Security and the fly likes Is it possible to convert a key to string (like to store it in a file)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "Is it possible to convert a key to string (like to store it in a file)?" Watch "Is it possible to convert a key to string (like to store it in a file)?" New topic
Author

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

harke baj
Greenhorn

Joined: Feb 02, 2010
Posts: 28
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

Joined: Aug 11, 2007
Posts: 4659
    
    5

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.
 
subject: Is it possible to convert a key to string (like to store it in a file)?