package_control icon indicating copy to clipboard operation
package_control copied to clipboard

Function 'BCryptDeriveKeyPBKDF2' not found.

Open casper opened this issue 4 years ago • 2 comments

Sublime Text 3 on Windows Vista 32-bit. Package Control fails to load with below error.

Is there some way to fix this problem? It used to work fine before, but not any more.

...
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
Traceback (most recent call last):
  File "C:\Users\Casper\AppData\Roaming\Sublime Text 3\Installed Packages\Package Control.sublime-package\package_control/deps/oscrypto/_win/_cng_ctypes.py", line 143, in <module>
  File "./python3.3/ctypes/__init__.py", line 366, in __getattr__
  File "./python3.3/ctypes/__init__.py", line 371, in __getitem__
AttributeError: function 'BCryptDeriveKeyPBKDF2' not found
...

casper avatar Mar 19 '21 15:03 casper

The problem seems to be here: https://github.com/wbond/package_control/blob/8b947d227bfee2b514283e650c3f88c954ae1026/package_control/deps/oscrypto/init.py#L49

Windows Vista SP2 does not include BCryptDeriveKeyPBKDF2, unless manually patched with Windows Server 2008 SP2, which most distributions will not have installed.

Therefore on Vista it seems the backend should be changed to winlegacy and not win.

casper avatar Mar 27 '21 11:03 casper

Confirmed. This change fixes the issue:

       if sys.platform == 'win32':
            # Windows XP was major version 5, Vista was 6
            if sys.getwindowsversion()[0] <= 6:         # <- FIXED!!
               _module_values['backend'] = 'winlegacy'

casper avatar Mar 27 '21 12:03 casper

Should be addressed upstream at https://github.com/wbond/oscrypto

deathaxe avatar Sep 15 '22 18:09 deathaxe