Skip to content

Instantly share code, notes, and snippets.

View Zorahn's full-sized avatar

Søren Søe Holmgaard Nielsen Zorahn

View GitHub Profile
@ctigeek
ctigeek / PowershellAes.ps1
Last active August 12, 2024 13:05
Aes Encryption using powershell.
function Create-AesManagedObject($key, $IV) {
$aesManaged = New-Object "System.Security.Cryptography.AesManaged"
$aesManaged.Mode = [System.Security.Cryptography.CipherMode]::CBC
$aesManaged.Padding = [System.Security.Cryptography.PaddingMode]::Zeros
$aesManaged.BlockSize = 128
$aesManaged.KeySize = 256
if ($IV) {
if ($IV.getType().Name -eq "String") {
$aesManaged.IV = [System.Convert]::FromBase64String($IV)
}