mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add -AsPlainText to ConvertFrom-SecureString (#11142)
This commit is contained in:
committed by
Aditya Patwardhan
parent
5605bf4195
commit
03f10f052d
@@ -22,10 +22,11 @@ Describe "SecureString conversion tests" -Tags "CI" {
|
||||
$ss = ConvertTo-SecureString -AsPlainText -Force abcd
|
||||
$ss | Should -BeOfType SecureString
|
||||
}
|
||||
|
||||
It "can convert back from a secure string" {
|
||||
$secret = "abcd"
|
||||
$ss1 = ConvertTo-SecureString -AsPlainText -Force $secret
|
||||
$ss2 = convertfrom-securestring $ss1 | convertto-securestring
|
||||
[pscredential]::New("user",$ss2).GetNetworkCredential().Password | Should -Be $secret
|
||||
$ss2 = ConvertFrom-SecureString $ss1 | ConvertTo-SecureString
|
||||
$ss2 | ConvertFrom-SecureString -AsPlainText | Should -Be $secret
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user