0

I have a Powershell app that retrieves some secret data- then needs to execute a .NET exe (locally) passing that data. It appears that passing the data as a raw param could expose it to users on the machine, so I'm looking for a way to keep it secure.

Possible solutions-

  1. Get the data directly from the C# app (possible, but not ideal)
  2. Put the data in an EFS encrypted file and pass the file location
  3. Encrypt the param with a shared key (something built into windows?)

Any tips/guidance would be appreciated.

therealsix
  • 656
  • 2
  • 7
  • 16

1 Answers1

1

Please see this Microsoft Technet article:

Working With Passwords and Secure Strings in Windows Powershell

The gist of the above article:

Basic example of encrypting a string:

$PlainParam = "param you want to encrypt"
$SecureParam = $PlainParam | ConvertTo-SecureString -AsPlainText -Force

Cmdlets to look into:

ConvertTo-SecureString
ConvertFrom-SecureString    
Vasili Syrakis
  • 9,321
  • 1
  • 39
  • 56