简体   繁体   English

ConvertTo-SecureString-每个人都使用加密密码

[英]ConvertTo-SecureString - use encrypted password for everyone

I stored a pw encrypted in a txt file and load it into a powershell session with: 我将加密的pw存储在txt文件中,并使用以下命令将其加载到powershell会话中:

gc .\\localadmincred.txt | convertto-securestring

This doesn't work because i read that only the User that encrypted that key, can convert it to a secure string, everyone als can't decrypt the string that is in my txt. 这是行不通的,因为我读到只有加密该密钥的用户才能将其转换为安全的字符串,每个人都无法解密我txt中的字符串。

How can I store an encrypted string in a file so that everyone can use it with convertto-securestring ? 如何将加密的字符串存储在文件中,以便每个人都可以将其与convertto-securestring一起使用?

You can encrypt the string with a key. 您可以使用密钥对字符串进行加密。 If another user has the key, he/she will be able to decrypt the string. 如果另一个用户拥有密钥,则他/她将能够解密该字符串。

See example: Secure Password with PowerShell: Encrypting Credentials – Part 2 请参见示例: 使用PowerShell的安全密码:加密凭据–第2部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM