Transferring files with Base64 encoding

Transferring files between a Client and Server could be restricted in some environments and we might not be able to transfer a file by using internet file sharing services as an intermediate. In this case if we can do text copy/paste clipboard between client and server, we are most likely also able to transfer binary files.

This post shows a way of transferring binaries with Base64 on both Windows and Linux.

 

Windows Systems

In windows we could use both Powershell or Certutil.exe to to encode/decode a file. Both methods will be shown here.

Powershell

So in our first command we encode and output to base64 text from our binary.

 

 

In this command we decode and create our binary file based on our base64 output from above:

 

 

Certutil

Like Powershell, Certutil is also built-into Windows as a native tool.

 

 

Linux Systems

On Linux we simply use cat, echo and base64 commands.

Encode binary file with base64:

This command will print the base64 as a string.

 

This command will encode and pipe to a file.

 

Decode binary file with base64:

 

Check md5 file integrity :

You can verify the MD5 checksum of the file before and after transfer/encoding.

Leave a Reply