Convert a secure string to plain text

后端 未结 4 862
滥情空心
滥情空心 2020-11-28 03:39

I\'m working in PowerShell and I have code that successfully converts a user entered password into plain text:

$SecurePassword = Read-Host -AsSecureString  \         


        
4条回答
  •  囚心锁ツ
    2020-11-28 04:24

    In PS 7, you can use ConvertFrom-SecureString and -AsPlainText:

     $UnsecurePassword = ConvertFrom-SecureString -SecureString $SecurePassword -AsPlainText
    

    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/ConvertFrom-SecureString?view=powershell-7#parameters

    ConvertFrom-SecureString
               [-SecureString] 
               [-AsPlainText]
               []
    

提交回复
热议问题