Windows base64 Encoding and Decoding Using certutil

I ran into a scenario where I was able to upload ASCII files, but executable files were being saved improperly. A common workaround for this is to use base64 to encode the executable, transfer the encoded data, then decode it on the recipient machine.

The version of Windows I was using did not have base64 or uuencode. I was able to use “certutil” to decode my base64 encoded executable:

certutil Documentation from Microsoft Technet

The -encode and -decode flags do exactly what I wanted. I transferred my file as foo.asc and decoded it like so:

certutil -decode c:\foo.asc c:\foo.exe

Encoding a file on Windows would work the same way:

certutil -encode c:\foo.exe c:\foo.asc

It worked! foo.exe matches the md5sum of the executable I initially encoded and runs as intended!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s