PowerShell Base64 Encode & Decode

Let's see how we can do this with PowerShell:

Pwnbox Check SSH key MD5 Hash

md5sum id_rsa

Pwnbox Encode SSH key to Base64

cat id_rsa | base64 -w 0;echo

We can copy this content and paste it into a Windows PowerShell terminal and use some PowerShell functions to decode it.

[IO.File]::WriteAllBytes("C:\\Users\\Public\\id_rsa", [Convert]::FromBase64String("<base64>"))

We can confirm if the file was transferred successfully using the Get-FileHash cmdlet, which does the same thing that md5sum does.

Confirming the MD5 Hashes Match

Get-FileHash C:\\Users\\Public\\id_rsa -Algorithm md5

<aside> 🗒️

While this method is convenient, it's not always possible to use. Windows Command Line utility (cmd.exe) has a maximum string length of 8,191 characters. Also, a web shell may error if you attempt to send extremely large strings.

</aside>