DPAPI Encryption


The following code uses the Windows API CryptProtectData to encrypt the string strValue by using the logged-on user’s credentials as a key. The encrypted value is stored in the user’s personal application data directory with the name <strSettingName>.txt.

Settings.SaveEncrypted(strSettingName, strValue)

The next line of code uses the Windows API CryptUnprotectData to decrypt the setting stored in the file <strSettingName>.txt. The result is assigned to the string strValue:

strValue = Settings.LoadEncrypted(strSettingName) 




Security for Microsoft Visual Basic  .NET
Security for Microsoft Visual Basic .NET
ISBN: 735619190
EAN: N/A
Year: 2003
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net