IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Calling Python gurus...
I'm getting my feet wet in Python trying to modify a Calibre plugin. But I think I've bitten off more than I can chew.

What I'm trying to modify is a piece of code that calls Windows' CryptUnprotectData() call. Ergo, it runs fine in Windows, but I want it to run in Linux. Somewhat fortunately, this function *has* been implemented in Wine and is available in a Wine .so. Unfortunately, (since it's technically a Win32 API call) it is declared "stdcall". Which Python's "cdll" import can't load.

So. Ideas about going forward? I'm thinking the quickest way to make this work would be to code a shim function in C that exposes itself as "cdecl" and simply calls the Wine function. Then Python can load the shim file.

Or am I barking up the wrong tree entirely?

Wade.

P.S. The plugin is for decoding a certain type of file. It works fine in the Windows version of Calibre, but I want to use the Linux version of Calibre.
Static Scribblings http://staticsan.blogspot.com/
New Maybe take a look at "ctypes"? HTH a little.
New Already looked at that.
The ctypes import provides cdll in Linux and cddl, windll and oledll in Windows. :-/ It'd be nice if windll also existed in Linux Python, but I don't know how to make that happen. I think I'd need to add code to the .so behind ctypes. Somehow.

Wade.
Static Scribblings http://staticsan.blogspot.com/
New linux doesnt have an equivalent function?
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 55 years. meep
New Not directly.
The key characteristic of CryptProtectData is that it has an obfuscated key generation process based on the user credentials.

Wade.
Static Scribblings http://staticsan.blogspot.com/
New Are you trying to move the encrypted data between systems?
http://msdn.microsof...28v=VS.85%29.aspx

The CryptUnprotectData function decrypts and does an integrity check of the data in a DATA_BLOB structure. Usually, the only user who can decrypt the data is a user with the same logon credentials as the user who encrypted the data. In addition, the encryption and decryption must be done on the same computer. For information about exceptions, see the Remarks section of CryptProtectData.
New Technically no.
The data would have been encrypted with Wine's CryptProtectData. I'm simply trying to call Wine's CryptUnprotectData from a Linux program (on the same system) instead of calling from a Wine program.

Wade.
Static Scribblings http://staticsan.blogspot.com/
     Calling Python gurus... - (static) - (6)
         Maybe take a look at "ctypes"? HTH a little. -NT - (Another Scott) - (1)
             Already looked at that. - (static)
         linux doesnt have an equivalent function? -NT - (boxley) - (1)
             Not directly. - (static)
         Are you trying to move the encrypted data between systems? - (crazy) - (1)
             Technically no. - (static)

This is the reference implementation of the self-referential joke.
79 ms