Carl Franklin reports on another DPAPI wrapper,
this one in VB.NET:
If you went to DevDays 2004 then you know about DP-API. This is part of the CryptoAPI that didn't make it into the .NET Framework. The nice folks at Vertigo Software wrote a nifty VB.NET managed code wrapper around DPAPI because it's so dang hard to use directly. They make it freakin easy to encrypt and decrypt strings without having to manage keys.
I extracted the DPAPI class from IssueVision (the reference application Vertigo wrote for Microsoft just for DevDays 2004) and turned it into a DLL assembly. Then I wrote a test harness application that encrypts and decrypts a string in a text box. The encrypted string is written to a file. I also used Matt Griffith's awesome .NET Utilities DLL to do some hi-res timing on the code. Using this test harness I was able to decrypt a 1.8MB string in about 365 ms on a 2.6GHz P4 with 1GB RAM. Not bad.
DPAPI makes use of the user's credentials and an entropy (extra data you add to the mix) to create the encrypted result and decrypt the ciphertext. Pretty slick. Anyway, you can download the dpapi assembly and test harness pruned and ready to go right here. Thanks Vertigo!