How to encrypt a string and decrypt it using a password

33 Views Asked by At

Is there a way I can encrypt a simple string, let's say a key that's 35 characters long and convert it to something shorter?

Let's say I give the script on a USB drive to the users and let them run the script. It will ask for a pin/simple password that they can memorize rather than that 35 characters? I don't want to put the 35 character key in Powershell as plaintext. I don't care if the user can decrypt it because they already know what the key is. We're trying to prevent the usb drive from falling into the wrong hands.

I was thinking about encrypting 31 characters and ask the user to input 4 but was hoping if there's a native way to do this in Powershell.

Thank you,

0

There are 0 best solutions below