Solved

Lsa secrets

Posted on 2002-03-23
2
774 Views
Last Modified: 2013-12-03
I am storing a password as a LSA secret using LsaStorePrivateData using a hardcoded key string. I am able to get the password using LsaRetrievePrivateData. The point is I have a feature in my app that can be optionally password protected. So if the user removes the password protection I want to delete the password from the LSA database. The next time when I query the LSA database with the same key string I will get an error and I know it is not password protected. I can store another secret to check whether it is password protected but it is a kludge.

P.S. My app has admin privileges. It is a COM server launched under Administrator identity
0
Comment
Question by:vbk_bgm
2 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 100 total points
ID: 6891426
Did you read the SDK docs?

Under the PARAMETERS section for LasStorePrivateData see:

PrivateData
Pointer to an LSA_UNICODE_STRING structure containing the private data to store. The function encrypts this data before storing it.
If this parameter is NULL, the function deletes any private data stored under the key and deletes the key. Subsequent attempts to retrieve data from the key will return the STATUS_OBJECT_NAME_NOT_FOUND error code.


As it says, to DELETE the data (as I think you are asking... your question is somewhat unclear) you store it with a NULL in the PrivateData parameter.
0
 
LVL 2

Author Comment

by:vbk_bgm
ID: 6891956
Yeah that works! I will read the SDK docs carefully hereon.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question