I am looking for a way to encrypt/decrypt data on windows and linux platforms. The data gets encrypted in windows and the same data needs to be decrypted on linux/windows and vice versa.

I understand I need a key to encrypt/decrypt data and have general familiarity with symmetric/asymmetric encryption.
What I am wondering is if there is a way to do the above without storing the key anywhere. I saw lot of discussion threads that assume you are storing the key somewhere secure.

Is it possible to generate a symmetric key based on secret password that only my code knows about and use it for this purpose?
I don't want to store the key anywhere. On each boot up, the key that is generated based on secret password should be able to decrypt data that was encrypted by generated key from previous boot up. Similarly I should be able to encrypt data with this key for later sessions to decrypt.

I read about PBKDF2. It is not clear to me whether it is meant for comparing password hashes or for doing something like above.

I appreciate if you can point me to examples.


1 Answer 1


Different programs can encrypt data without storing a key somewhere, but rather a password. Zip/rar files can be encrypted, or instance, and programs like TrueCrypt or VeraCrypt can do the same. The file gets encrypted and protected with a password. You need the program on the destination location in order to decrypt.

If you want to create your own program, then according to your question, the "key" is stored in your code. You have the same key storage issues in code as you do in any other key storage scenario.

  • Yes. I am looking for a way to do this in code.
    – videoguy
    Commented Jan 19, 2015 at 22:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .