How to check global reverse encryption though JNA?

I am trying to get the global value of a parameter Reversible Encryption

on Windows via JNA (Java Native Access) programmatically.

I can read other values ​​from the user's global password policy via JNA, for example

  • Use password history
  • Maximum password age
  • Minimum password age
  • Minimum password length

But there is no information on how you can get the specific value of reverse encryption in Java? I've tried google but to no avail. Somebody knows?

+3


source to share


1 answer


The reversible encryption option is available in WMI in the RSOP_SecuritySettingBoolean class using the key ClearTextPassword

.

You can query WMI through the command line (for example wmic /NAMESPACE:\\root\RSOP\Computer path RSOP_SecuritySettingBoolean

) or through powershell. I have implemented a WMI Util class using JNA , which implements C code for a WMI query, which you can copy if you prefer a programmatic approach (you will need a few more classes.)

You can also do this on the command line: Secedit.exe /export /cfg c:\cfg.txt

and read the output file looking for the value ClearTextPassword

.



It looks like you can extract the value with a binary dump of the contents of the registry key \HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\F

, in which case the value will be stored in the most significant 4 bits of the byte at offset 0x004C. You can read the registry using the JNA class Advapi32Util (in this case, probably registryGetBinaryValue()

).

I also found a place in the registry, which can be useful (completely untested) \HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SeCEdit\Reg Values

. This indicates similar settings in Machine/System/CurrentControlSet/Services/Netlogon/Parameters

, which may or may not be useful.

0


source







All Articles