I have a powershell script that get-content a csv file. I would like this csv file to be encrypted, so the user cannot change its content. How can this be done ? Thanksk !
-
If modifications are your primary concern, NTFS permissions through ACLs is a much more robust way of handling this situation. Set this script or CSV to read-only for all users, read/write for admins for example.Goyuix– Goyuix2012-10-04 20:24:55 +00:00Commented Oct 4, 2012 at 20:24
Add a comment
|
1 Answer
There is no need to do that. Simply calculate checksum and hardcode it in the script. Stop processing the csv file when it checksum isn't predefined.
If you still want to do your logic, there is EncriptDecript function for instance.
2 Comments
Henry Meyer
if I do it this way, the checksum appears in the main script, so if the user wants to change it, he can, right ?
majkinetor
Well, you can obfuscate that a lot. And if user has access to script, it can also see how to decript, so you can't really be secure with scripts unless they use some module/function that reads from protected location. For instance, you can change above functions so that password is obtained from secure location in registry or file system. But why doing it when you can protect the script itself ? Or u can put csv in the archive and set a password...