Update encrypt-file.ps1

This commit is contained in:
Markus Fleschutz 2023-01-13 18:35:46 +01:00
parent a56e58c1cf
commit b3c23dac12

View File

@ -118,8 +118,9 @@ try {
if ($Password -eq "" ) { $Password = read-host "Enter password" }
$StopWatch = [system.diagnostics.stopwatch]::startNew()
$PasswordBase64 = [System.Convert]::ToBase64String($Password)
EncryptFile "$Path" -Algorithm AES -KeyAsPlainText $PasswordBase64 -RemoveSource
[char[]]$PasswordAsArray = $Password
$PasswordAsBase64 = [System.Convert]::ToBase64String($PasswordAsArray)
EncryptFile "$Path" -Algorithm AES -KeyAsPlainText $PasswordAsBase64 -RemoveSource
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ file encrypted in $Elapsed sec"