[C#] Decrypt Office 2010 Digital Product ID

Discussion in 'Mixed Languages' started by Josh Cell, Jul 11, 2011.

  1. DrCoolZic

    DrCoolZic MDL Member

    Jan 15, 2011
    247
    326
    10
    Thanks for your answer. Yes in WMI you find the partial key as usual but I also found that the office key information is located somewhere else (in C2R) and it is no more encrypted.
    But I need to further investigate. There are so many different way to install O 2019 ...
     
  2. K4onashi

    K4onashi MDL Debugger

    Mar 7, 2012
    1,815
    1,987
    60
    I would search the registry for 'Values' containing 'DigitalProductId' as a start point.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. DrCoolZic

    DrCoolZic MDL Member

    Jan 15, 2011
    247
    326
    10
    For reference it seems that with Office 2019 the key is no more encrypted in DigitalProductID
    It is now provided not encrypted in ProductKeys. If you have several office product installed the keys are concatenated separated by comma.
    This key is located here: SOFTWARE\Microsoft\Office\ClickToRun\Scenario\INSTALL
    The code to use looks like:
    Code:
                List<string> DetectedKeys = new List<string>();
                string RegistrationPathName, DigitalIdPath;
                RegistryKey RegistryBase, registry;
                // if office is 32-bits we want the to use the 32-bit registry
                if (GetOfficeArch() == "x86")
                    RegistryBase = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
                else
                    RegistryBase = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
    
                // get keys for office 2010 (14.0), 2013 (15.0), 2016 (16.0)
    ...
                // get keys for office 2019 (placed inClickToRun ...)
                RegistrationPathName = @"SOFTWARE\Microsoft\Office\ClickToRun\Scenario\INSTALL";
                using (registry = RegistryBase.OpenSubKey(RegistrationPathName, false))
                {
                    if (registry != null)
                    {
                        // keys for all product are concatenated (separated by comma)
                        string keys = (string)registry.GetValue("ProductKeys");
                        foreach (string key in keys.Split(',').ToList<string>())
                            DetectedKeys.Add(key);
                    }
                }