lsastore.py 457 B

1234567891011
  1. import win32security
  2. policy_handle = win32security.GetPolicyHandle('',win32security.POLICY_ALL_ACCESS)
  3. privatedata='some sensitive data'
  4. keyname='tmp'
  5. win32security.LsaStorePrivateData(policy_handle,keyname,privatedata)
  6. retrieveddata=win32security.LsaRetrievePrivateData(policy_handle,keyname)
  7. assert retrieveddata==privatedata
  8. ## passing None deletes key
  9. win32security.LsaStorePrivateData(policy_handle,keyname,None)
  10. win32security.LsaClose(policy_handle)