0

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 !

1
  • 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. Commented Oct 4, 2012 at 20:24

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

if I do it this way, the checksum appears in the main script, so if the user wants to change it, he can, right ?
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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.