Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
resinfo-gt
swmb
resinfo-swmb
Commits
e98fea25
Commit
e98fea25
authored
May 10, 2022
by
Olivier De Marchi
Browse files
test keyfile.key exist
parent
83d59fcd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
dists/uninstall-kaspersky/set-password-encrypted.ps1
dists/uninstall-kaspersky/set-password-encrypted.ps1
+6
-4
No files found.
dists/uninstall-kaspersky/set-password-encrypted.ps1
View file @
e98fea25
...
...
@@ -2,11 +2,13 @@
$KeyFile
=
Read-Host
-Prompt
"Key File (please put .key extension)"
$Password
=
Read-Host
-AsSecureString
-Prompt
"Password to secure"
$Key
=
New-Object
Byte
[]
32
# create key AES 256-bit key (32 bytes)
[
Security.Cryptography.RNGCryptoServiceProvider
]::
Create
()
.
GetBytes
(
$Key
)
$Key
|
Out-File
$KeyFile
if
(
$KeyFile
)
{
$Key
=
New-Object
Byte
[]
32
# create key AES 256-bit key (32 bytes)
[
Security.Cryptography.RNGCryptoServiceProvider
]::
Create
()
.
GetBytes
(
$Key
)
$Key
|
Out-File
$KeyFile
$EncryptedPass
=
ConvertFrom-SecureString
-SecureString
$Password
-Key
$Key
$EncryptedPass
=
ConvertFrom-SecureString
-SecureString
$Password
-Key
$Key
}
Write-Output
""
Write-Output
"# Lines to add in your configuration file Custom-VarOverload.psm1"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment