#Requires -Version 4.0 <# .SYNOPSIS "Decrypts" the obfuscated password hashes used by the mail signature tool .DESCRIPTION "Decrypts" the obfuscated password hashes used found in the configuration xml file of the mail signature tool. Created to demonstrate that "security through obscurity" is totally useless. Storing symmetrically "obfuscated" data thogether with the tool used to obfuscate is a extraordinary stupid idea. Compiling senstitve stuff into a assembly, dll file, executable or what ever is bad practice and doesn't add any security. .NOTES Author: kurator | lagerhaus128.ch Revision 0: Initial revision .EXAMPLE Get-MailSignatureToolDecryptedPassword -EncryptedString ` 'uYP3vswNj5n7Tk+JQX0/mWqAMbgOMKViTkVp/xonM9wzCKn8TGXWjYsH8O/yxNdU' #> Function Get-MailSignatureToolDecryptedPassword { [CmdletBinding()] param( [Parameter(ParameterSetName="Strings",Mandatory="true")] ` [String]$EncryptedString ) Try { [System.Security.Cryptography.RijndaelManaged]$RijndaelManaged = ` New-Object System.Security.Cryptography.RijndaelManaged; [System.IO.MemoryStream]$MemoryStream = New-Object ` System.IO.MemoryStream( , [Convert]::FromBase64String($EncryptedString) ) [System.Byte[]]$Buffer = New-Object System.Byte[] 16 $MemoryStream.Read($Buffer,0,16) | Out-Null $RijndaelManaged.IV = $Buffer Remove-Variable Buffer $RijndaelManaged.Key = ` (New-Object ` System.Security.Cryptography.MD5CryptoServiceProvider ` ).ComputeHash( [System.Text.Encoding]::UTF8.GetBytes("cixy") ) [System.Security.Cryptography.CryptoStream]$CryptoStream = ` New-Object System.Security.Cryptography.CryptoStream( [System.IO.Stream]$MemoryStream ` ,$rijndaelManaged.CreateDecryptor() ` ,[System.Security.Cryptography.CryptoStreamMode]::Read ) [System.Byte[]]$numArray = New-Object System.Byte[] ` ([int]$MemoryStream.Length - 16 + 1) [System.Text.Encoding]::UTF8.GetString( $numArray ` , 0 ` , $CryptoStream.Read($numArray, 0, $numArray.Length) ) } Catch { Write-Error $_.Exception.Message } }