How can I encrypt a string of information and put it on a piece of paper and be able to plug that encrypted text back into the algorithm with a password and unlock the information? Is this secure?
2 Answers
Being that you want to use the same password for encryption and decryption, this is symmetric encryption. You can use openssl
to do symmetric encryption.
To encrypt the plaintext:
echo -n 'hello world!' | openssl aes-256-cbc -e -salt -pbkdf2 -iter 10000 | base64
It will prompt you for a password, then produce the ciphertext in base64-encoded form, like so:
U2FsdGVkX19e/xfT89w7I5dQqiqd+dNxMu5E868fyWA=
Copy the base-64 encoded ciphertext on the piece of paper. Then, when it comes time to decrypt the ciphertext, use openssl
again, like so:
echo -n 'U2FsdGVkX19e/xfT89w7I5dQqiqd+dNxMu5E868fyWA=' | base64 -d | openssl aes-256-cbc -d -salt -pbkdf2 -iter 10000
After entering the correct password, it will produce the plaintext that you started with:
hello world!
-
Thanks... Should I write on the paper what algorithm it uses (aes-256) in case I forget? Also, is it safe to store cryptocurrency wallet seeds like this? Commented Jan 27 at 14:07
-
Writing the algorithm is a good idea. You might also want to write the above commands as well, as these show how the AES key is derived from the password. I would use extreme caution if encrypting cryptocurrency seeds this way - if an attacker found the paper containing the cyphertext, then there is little to slow him down if he tries to brute-force the password. If you decide to do this, make sure the password is very strong.– mti2935Commented Jan 27 at 14:50
-
Well I know the password is definitely not in a password list, never been used anywhere else, and I doubt that anyone will be looking through the papers anytime soon... Does this mean anything? Commented Jan 27 at 15:33
-
Only you can evaluate the risk. Of course, the risk will increase with the value of the cryptocurrency that you have assigned to the address. And, the risk will decrease with the amount of entropy of your password. Nowadays, even passwords with 60+ bits of entropy can be cracked in a few days, using just a few thousand dollars worth of equipment. See security.stackexchange.com/questions/265805/… for more info.– mti2935Commented Jan 27 at 16:53
-
1So, is your question really "how can I security store my crypto wallet seed?" Because that's a whole different question.– schroeder ♦Commented Jan 29 at 21:53
The principle is that encryption converts from clear text to binary data, then you use any method whatsoever to convert binary data into something that humans find easy to read and write or type, send this to a receiver (if you are the receiver you can just print it and keep the paper), then the receiver converts from human readable to binary, and finally the binary data is decrypted to give the original clear text. The conversion between binary and human readable doesn’t need to be secure whatsoever.
Base-64 encoded text is human readable, but not very human readable. Everything is uppercase and lowercase letters and digits plus two more symbols, all equally likely. This is not how human written text works.
You could create a list of 8192 natural words in your favourite language. Then convert 13 binary bits to one of those words. Send lines of text; each line contains as many words as you like separated by space characters.
-
Encryption only outputs binary data? I'm not sure that's true.– schroeder ♦Commented Feb 2 at 21:14
-
Everything is binary data. And unless you dug out an old Enigma, your encryption produces binary data. This can as a second step be converted to something that is easier to send or store. Commented Feb 3 at 7:39
-
-