安全な文字列をプレーンテキストに変換する
PowerShellで作業していて、ユーザーが入力したパスワードをプレーンテキストに正常に変換するコードがあります。 $SecurePassword = Read-Host -AsSecureString "Enter password" | convertfrom-securestring | out-file C:\Users\tmarsh\Documents\securePassword.txt 私はそれを元に戻すためにいくつかの方法を試しましたが、どれも正しく機能していないようです。最近、私は以下を試しました: $PlainPassword = Get-Content C:\Users\tmarsh\Documents\securePassword.txt #convert the SecureString object to plain text using PtrToString and SecureStringToBSTR $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($PlainPassword) $PlainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) [Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR) #this is an important step to keep things secure これもエラーになります。 Cannot convert argument "s", with …