Error running Decrypt with DPAPI

T

Tony

I am using the DPAPI for encryption in VS 2005 Framework 2.0.

I am able to encrypt stings just fine, but when decrypting the
encrypted string I get the error:

"Decryption Failed: Unable to update the password. The
value provided for the new password does not meet the length,
complexity or
history requirement of the domain. "

I am using a windows form and have tried both machine and user store.
I have created a DPAPI wrapper myself and used the ProtectedData
wrapper that comes with framework 2.0.

This used to work with framework 1.1, not sure what happend. Any help
would be appreciated.
 
T

Tony

I was able to figure out what the error was being derived from. The
CryptUnprotectData function is trying to open a prompt (
CRYPTPROTECT_PROMPTSTRUCT) for a password to allow the data blob to be
decrypted, but the CRYPTPROTECT_UI_FORBIDDEN flag is set so it's just
throwing the error above.

I turned off the flag and the prompt was displayed but my password
wasn't accepted so I still wasn't able to decrypt the string. No
prompts are displayed during encryption. So there's a little more
information. Still looking for a solution...
 
T

Tony

I wasn't able to figure out what was causing the problem with the
sample provided by MSN, but I found different sample code that ended up
working.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top