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.

3
  • Could you please provide more information about "some secret data"? Commented Feb 16, 2014 at 14:54
  • Is the user running this script? Commented Feb 16, 2014 at 15:59
  • Create a named pipe in PowerShell and read from it in C#? Commented Feb 16, 2014 at 20:34

1 Answer 1

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    
Sign up to request clarification or add additional context in comments.

1 Comment

Seems right. Unfortunately I'm locked to PS2 for the moment, so I'm back at the EFS file. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.