Hi, Jeff, Von: Jeff Hardy > Sorry for the late reply. You've encountered the biggest issue with > IronPython, which is that it can't load Python extensions that are written in > C. > > In this case, the _AES modules (_AES.so) is a C library that depends on > CPython's implementation. Unfortunately, if PyCrypto doesn't provide a pure- > Python fallback (and it looks like it doesn't, although I may have missed > it), there's no way to get it to work in IronPython (there is the old > IronClad project, but it hasn't been updated in years and almost certainly > would not work with current versions).
I see one possibility: one could try to reimplement the _AES module in C#, possibly based on the .NET Crypto APIs, or as a clean room implementation. Best regards Markus Schaber CODESYS® a trademark of 3S-Smart Software Solutions GmbH Inspiring Automation Solutions 3S-Smart Software Solutions GmbH Dipl.-Inf. Markus Schaber | Product Development Core Technology Memminger Str. 151 | 87439 Kempten | Germany Tel. +49-831-54031-979 | Fax +49-831-54031-50 E-Mail: m.scha...@codesys.com | Web: http://www.codesys.com | CODESYS store: http://store.codesys.com CODESYS forum: http://forum.codesys.com Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. > > On Wed, Oct 29, 2014 at 10:43 PM, Baron Oldenburg > <baron.oldenb...@leviathansecurity.com> wrote: > > Hello! > > > > > > > > I’m attempting to import a module (KillerBee) in IronPython. I’ve > > encountered a couple of issues along the way, some of which I’ve been > > able to fix. I’m hoping the mailing list can help me out with what I > > haven’t fixed. Here are the problems I’ve encountered and the steps I’ve > taken: > > > > > > > > 1. “Exception during object creation: no module named killerbee” > > > > a. Per > > http://stackoverflow.com/questions/1371994/importing-external-module-i > > n-ironpython, I added the following which allowed IronPython to > > recognize killerbee as a module and let me import it: > > > > var paths = engine.GetSearchPaths(); > > > > paths.Add(@"/usr/lib/python2.7/site-packages/"); > > > > engine.SetSearchPaths(paths); > > > > 2. “Exception during object creation: cannot import _AES from > > Crypto.Cipher” > > > > a. I tracked this error down to this line in a killerbee file > > “dot154decode.py”: > > > > “from Crypto.Cipher import AES” > > > > and then further to /usr/lib/python2.7/site-packages/Crypto/Cipher/AES.py: > > > > > > “from Crypto.Cipher import _AES” > > > > In the same directory as AES.py there is an _AES.so. > > > > b. If I attempt this from the python interpreter, there are no errors: > > > > $ python > > > > Python 2.7.8 (default, Sep 24 2014, 18:26:21) > > > > [GCC 4.9.1 20140903 (prerelease)] on linux2 > > > > Type "help", "copyright", "credits" or "license" for more information. > > > >>>> from Crypto.Cipher import AES > >>>> import Crypto > >>>> print Crypto.__version__ > > > > 2.6.1 > > > >>>> > > > > c. If I attempt this from IronPython with the following code (instead > > of importing killerbee): > > > > engine.ImportModule("Crypto.Cipher.AES"); > > > > I get the same error (“cannot import _AES from Crypto.Cipher”). > > > > d. If I attempt to just import Crypto.Cipher > > (“engine.ImportModule("Crypto.Cipher");”) there are no errors. > > > > Before I start trying increasingly complicated workarounds, does > > anyone have an idea as to the possible root cause? I’ve searched > > around on the Internet generally and in outstanding IronPython issues > > specifically for other people with this problem, but I’ve only found > > the following semi-related hits around IronPython and pycrypto: > > > > > > > > · > > http://stackoverflow.com/questions/2365661/how-to-create-a-package-in- > > c-sharp-for-use-in-ironpython > > > > · http://www.pyinstaller.org/ticket/881 > > > > · > > http://lists.ironpython.com/pipermail/users-ironpython.com/2006-Novemb > > er/018956.html > > > > · https://bitbucket.org/mvdk/ironpycrypto > > > > > > > > The relevant parts of the source look like this: > > > > > > > > using IronPython; > > > > using IronPython.Hosting; > > > > using Microsoft.Scripting; > > > > using Microsoft.Scripting.Hosting; > > > > > > > > ScriptEngine engine = Python.CreateEngine(); > > > > var paths = engine.GetSearchPaths(); > > > > paths.Add(@"/usr/lib/python2.7/site-packages/"); > > > > engine.SetSearchPaths(paths); > > > > engine.ImportModule("Crypto.Cipher.AES"); > > > > > > > > Thanks for your time! I’m happy to provide any other details or source > > code necessary to continue debugging. > > > > > > > > Baron > > > > > > _______________________________________________ > > Ironpython-users mailing list > > Ironpython-users@python.org > > https://mail.python.org/mailman/listinfo/ironpython-users > > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users@python.org > https://mail.python.org/mailman/listinfo/ironpython-users _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users