close
# 定義解密函數 function Decrypt-Password { param ( [string]$KeyFilePath, [string]$EncryptedPasswordFilePath ) Write-Host "解密憑證私鑰密碼..." $Key = [System.Convert]::FromBase64String((Get-Content $KeyFilePath)) $EncryptedPassword = Get-Content -Path $EncryptedPasswordFilePath $SecurePassword = ConvertTo-SecureString -String $EncryptedPassword -Key $Key $Password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecurePassword)) Write-Host "憑證私鑰密碼已成功解密: $Password" -ForegroundColor Green } # 解密證書私鑰密碼 Decrypt-Password -KeyFilePath $KeyFilePath -EncryptedPasswordFilePath $EncryptedPasswordFilePath
參考資料:
ChatGPT 問答測試結果
文章標籤
全站熱搜
留言列表