Is there a method to encrypt passwords stored in a

2019-02-26 01:40发布

问题:

I have a VBS script I use at work for automating tasks when connected to Cisco routers and switches, including automating the login process. Not unreasonably people are a little edgy about storing their password in a plain text VBS file, so I provide them with the option to prompt every time for the password or have it stored in the script.

Is there a method by which I could call out to a Windows API which might be able to handle encryption for me? I would need a way to both a) encrypt the original password so it could be safely stored in the script, and b) provide a way of calling the decrypt function for use within my main script so that I can use the plain password. There is no built in function for encryption/decryption in VBS that I can find.

I realise that anyone with access to the script to read the password could also easily add a "WScript.Echo Decrypt(strEncryptedPassword)" type line to the script, but this doesn't seem to worry anyone!

Any help would be appreciated. I'm not great with API programming (in truth I'm a poor VB6 programmer turned network engineer) so please bear this in mind with responses.

回答1:

Check this article

Also consider the following links:

Encrypt function

Decrypt function

If your are interested in stronger encryption, then check this article