如何保护我的连接字符串? Powershell + XML [英] How to secure my connection string? powershell + xml
问题描述
我将连接字符串存储在XML文件中。然后我在Powershell脚本中使用它。有办法保护它/以某种方式对其进行加密吗?
I store my connection-string in XML file. Then i use it in powershell script. Is there a way to secure it/to encrypt it somehow?
推荐答案
我在Powershell中看到过两种加密方法
There are two methods I've seen for encrypting in Powershell
使用* SecureString cmdlet 。应该注意的是,只有对原始字符串进行加密的Windows ID才能对其进行解密(因为它使用Windows登录名作为密钥)
Use *SecureString cmdlets. It should be noted only the Windows ID that encrypted the original string can decrypt it (since it uses the Windows login as key)
在库-StringCrypto 函数
由于第一种方法的局限性,我使用第二种方法。然后,我将加密的连接字符串存储在SQL表中并锁定权限。要建立连接,我将从SQL表中检索连接字符串,并使用密码短语进行解密。
Because of the limitations of the first method, I use the second. I'll then store my encrypted connection string in a SQL table and lock down permissions. To make a connection I'll retrieve the connection string from the SQL table and decrypt using a pass phrase.
这篇关于如何保护我的连接字符串? Powershell + XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!