

#DECRYPT NEXTAB NX1610132S PS UPGRADE#
upgrade your PowerShell version to 3 - 5x.Īnother cross-compatible solution for AES file encryption using I have no PowerShellv2 anywhere in my environment to saintly check though.

Get-Command -Name Export-moduleMemberĬmdlet Export-ModuleMember 3.0.0.0

So, the fact that it is failing, should be expected, because if memory serves, Export-ModuleMember was not introduced until PowerShellv3.
#DECRYPT NEXTAB NX1610132S PS CODE#
Write-Host "decrypted message: $decMessage"īased on the source information for the code you linked to that you say you are using, it was not designed with PowerShell v2 in mind. Write-Host "decrypted bytes: $decMessageBytes" Write-Host "encrypted message: $encMessage" Write-Host "encrypted message bytes: $encMessageBytes" Write-Host "message bytes: $messageBytes" $decMessage = ::UTF8.GetString($decMessageBytes).Trim(0) $cipher.DoFinal($decMessageBytes, $len) | Out-Null $len = $cipher.ProcessBytes($encMessageBytes, 0, $encMessageBytes.Length, $decMessageBytes, 0) $decMessageBytes = New-Object byte $dataSize $dataSize = $cipher.GetOutputSize($encMessageBytes.Length) #$encMessageBytes = ::FromBase64String(::ReadAllText("C:\stack\")) #::WriteAllText("C:\stack\", $encMessage) $encMessage = ::ToBase64String($encMessageBytes) $cipher.DoFinal($encMessageBytes, $len) | Out-Null $len = $cipher.ProcessBytes($messageBytes, 0, $messageBytes.Length, $encMessageBytes, 0) $encMessageBytes = New-Object byte $dataSize $dataSize = $cipher.GetOutputSize($messageBytes.Length) $keyAndIVparam = New-Object Org.Bounc圜 $aesKeyParam, $IV $aesKeyParam = ::CreateKeyParameter("AES", $key) #specify cipher type (typically CFB or CBC) and padding (use NOPADDING to skip). $IV = ::UTF8.GetBytes("Some_Password") #or use some random phrase $secRandom.NextBytes($IV) | Out-Null #random generated 16 bytes # below are some random IVs to play around, if IV parameter is not provided by user just keep it is array of 0s #IV is a byte array, should be same as AES block size. $key = ::FromBase64String("9JODwRWWHp6+uACUiydFXNXPmWDHbcObhgqR/cvZ9zg=")

$keyGenParam = new-object Org.Bounc圜 $keyBytes, 256 # $messageBytes = ::ReadAllBytes("C:\stack\out.txt") $messageBytes = ::UTF8.GetBytes($message) Run this code: Add-Type -path "C:\stack\Bounc圜" It worked on my end in version 2 mode.ĭownload latest compiled assembly (Bounc圜) from here:Įxtract that dll to any folder (say C:\temp), right click on it, and check "Unblock" Below is the AES encryption/decryption implementation with that library. Key: 9JODwRWWHp6+uACUiydFXNXPmWDHbcObhgqR/cvZ9zg= New-CryptographyKey : You cannot call a method on a null-valued expression.Īt C:\Users\IEUser\Desktop\enc.ps1:399 char:27 When I tried running it on Windows 7, PowerShell v2.0, I get an error: I was able to AES encrypt files successfully using this script here, using Windows 10, PowerShell version 5.1.
