Ale*_*rov 0 rdp credentials azure
我在Azure中丢失了RDP密码.但我有cscfg文件和加密密码的证书.我如何从cscfg文件中获取密码?
function DecodePassword([string] $encodedPassword)
{
$encodedMessage = [Convert]::FromBase64String($encodedPassword);
$cms = New-Object System.Security.Cryptography.Pkcs.EnvelopedCms;
$cms.Decode($encodedMessage);
$store = $null;
try
{
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store('My', 'CurrentUser');
$cms.Decrypt($store.Certificates);
}
finally
{
$store.Close();
}
return [Text.Encoding]::UTF8.GetString($cms.ContentInfo.Content);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
798 次 |
| 最近记录: |