private/Get-AesSessionSecret.ps1
function Get-AesSessionSecret { [CmdletBinding()] param ( [Parameter()] [string] $cipherText ) $keyBytes = [Text.Encoding]::ASCII.GetBytes((Get-Process -PID $pid).ProcessorAffinity.ToString() + (Get-Process -PID $pid).Id.ToString()) $encryptionKey = [System.Byte[]]::new(32) for ($i = 0; $i -lt $keyBytes.length; $i++) { $encryptionKey[$i] = $keyBytes[$i] } $encryptedBytes = [System.Convert]::FromBase64String($cipherText) $aesCryptoServiceProvider = New-Object System.Security.Cryptography.AesCryptoServiceProvider $aesCryptoServiceProvider.Key = $encryptionKey $aesCryptoServiceProvider.IV = $encryptedBytes[0..15] $decryptor = $aesCryptoServiceProvider.CreateDecryptor(); $secretBytes = $decryptor.TransformFinalBlock($encryptedBytes, 16, $encryptedBytes.Length - 16) $decryptedSecret = [System.Text.Encoding]::UTF8.GetString($secretBytes) $aesCryptoServiceProvider.Dispose() return $decryptedSecret } # SIG # Begin signature block # MIIVigYJKoZIhvcNAQcCoIIVezCCFXcCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUtS4JOR6aGyxtKicP1S0wUG+H # z1qgghHrMIIFbzCCBFegAwIBAgIQSPyTtGBVlI02p8mKidaUFjANBgkqhkiG9w0B # AQwFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVy # MRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEh # MB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTIxMDUyNTAwMDAw # MFoXDTI4MTIzMTIzNTk1OVowVjELMAkGA1UEBhMCR0IxGDAWBgNVBAoTD1NlY3Rp # Z28gTGltaXRlZDEtMCsGA1UEAxMkU2VjdGlnbyB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