【问题标题】:Secure parameters with powershell exec使用 powershell exec 保护参数
【发布时间】:2014-02-17 08:50:07
【问题描述】:

我有一个 Powershell 应用程序,它检索一些秘密数据,然后需要执行一个 .NET exe(本地)传递该数据。似乎将数据作为原始参数传递可能会将其暴露给机器上的用户,所以我正在寻找一种方法来保证它的安全。

可能的解决方案-

  1. 直接从 C# 应用程序获取数据(可能,但不理想)
  2. 将数据放入 EFS 加密文件并传递文件位置
  3. 使用共享密钥加密参数(Windows 内置的东西?)

任何提示/指导将不胜感激。

【问题讨论】:

  • 您能否提供更多关于“一些秘密数据”的信息?
  • 用户是否在运行此脚本?
  • 在 PowerShell 中创建命名管道并在 C# 中读取它?

标签: c# security powershell


【解决方案1】:

请参阅这篇 Microsoft Technet 文章:

Working With Passwords and Secure Strings in Windows Powershell

以上文章的要点:

加密字符串的基本示例:

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

要查看的 Cmdlet:

ConvertTo-SecureString
ConvertFrom-SecureString    

【讨论】:

  • 看起来不错。不幸的是,我目前被锁定到 PS2,所以我回到了 EFS 文件。谢谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-11-21
相关资源
最近更新 更多