DPAPI - encrypting for another user?

584 Views Asked by At

It may be that security is a more apt location for this but I'll ask it here first.

If I want to encrypt some plaintext using DPAPI I have two scope options, CurrentUser and LocalMachine. Assume I want to encrypt data that will need decrypting by another user is there a way to do that using some functions that are in .NET?

It'd be nice if there was an overload of the ProtectedData.Protect method, something like:

ProtectedData.Protect(byte[] plaintextBytes, byte[] salt, UserInformation userInformation);

where UserInformation is just a POCO with properties for the domain, user name and password.

The use case here would be a service or a scheduled task running under the auspices of an account other than that of the logged on (interactive) user, but that would need to be installed by another user.

I could write a utility to encrypt the string, then use the RunAs functionality to run it, but is there way, other than this - if I have the domain, user name and password of the user - of doing what I need?

0

There are 0 best solutions below