Armoring binary data as text
Jump to navigation
Jump to search
Encoding binary data as clean ASCII text is a useful way to get a file across a channel that doesn't do well with arbitrary bytes. For example, when using some kinds of remote desktop access, file sharing is disabled but clipboard text sharing is allowed.
These variations are not mutually compatible; use the same tool on both ends.
GnuPG
Available on the typical Linux system and some others. Includes a 24-bit CRC.
# Armor to console (without redirection, run then copy armored from console) gpg -ao - --store infile > armored.txt # Dearmor from console (without redirection, run then paste and press ctrl+D) gpg -o outfile < armored.txt
certutil (Windows)
Available on recent Windows machines. No CRC is present, but the program can generate a digest if error checking is desired.
# Optional: Get hash of original certutil -hashfile infile SHA1 # Armor to armored.txt certutil -encode infile armored.txt # Dearmor armored.txt certutil -decode armored.txt outfile # Optional: Get hash of result (to compare with hash of original) certutil -hashfile outfile SHA1