Hashed password as parameter for a script

Jarrad-AFCU
New Contributor

Would anyone know how I would encrypt a password for use as a parameter in a script so I can pass that password to the script securely and then have the script decrypt the password so it could be used? I'm running a script that will prompt a Filevault enabled user for their password so that a local admin account can be added to Filevault. It works if I plaintext the admin password in the script, but obviously I don't want to do that. I'd like to be able to put the encrypted password as a parameter and then just call it to the script, but I'm sure I'd have to add the salt to the script in order for it to decrypt it...just have no clue how to do that myself.

2 REPLIES 2

DBrowning
Valued Contributor II

You will get mixed reviews on this, but here is a "solution" Jamf has provided: Jamf Encrypted Strings

boberito
Valued Contributor

Short answer....you cant really.

You can hide the password but can't really encrypt it.

obfuscation vs encryption