A Syntax for ConvertTo-SecureString is -
ConvertTo-SecureString [-String] [[-SecureKey] ]
I want to use this to create a secure string that is based on a user password, rather than the DPAPI.
I can create a securekey with the following code
$key = New-Object byte[](32)
$rng = [System.Security.Cryptography.RNGCryptoServiceProvider]::Create()
$rng.GetBytes($key)
but according to the docs
Valid key lengths are 16, 24, and 32 bytes
So it makes it difficult to just type a password in (that would fit into that size)
How would I convert "correcthorsebatterystaple" into a 32byte key? (such that I can then go to another machine and decrypt the secure string, using the same password)