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!
- 23,468
- 2
- 53
- 73
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.
- 2,381
- 14
- 17
-
-
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. – gnasher729 Feb 03 '24 at 07:39
-
-
Also, is it safe to store cryptocurrency wallet seeds like this?
– prestonferry Jan 27 '24 at 14:07