Quantcast
Channel: Security forum
Viewing all articles
Browse latest Browse all 12072

Creating User Dynamically And Using DPAPI

$
0
0

Hello.

For some project I need to:

1. Dynamically create local user account (for this I'm using UserPrincipal class from .NET framework)

2. Impersonate to that user (I wrote some classes that calls native LogonUser (advapi32.dll)

3. Use DPAPI to encrypt some user data. I also have some classes that calls native CryptProtectData and CryptUnprotectData (crypt32.dll)

The problem here is that when dynamically creating user, user specific folders are not created, even when I call LogonUser.

Since DPAPI will look for those folders, and the folders are not there, the call will fail.

Now, if I manually perform user login, those folders will be created, and after that all is good. But, I need a way to create those folders automatically, without performing manual login.

Is there a way to do that?


Viewing all articles
Browse latest Browse all 12072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>