Armoring binary data as text

From HalfgeekKB
Revision as of 05:54, 5 June 2015 by Psmay (talk | contribs) (Created page with "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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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