0

I work with odoo and I want to install the module of paybox : this one : https://bitbucket.org/anybox/anybox_paybox/ For that : this module needs pycrypto to work

So, I installed pycrypto in the linux server (ubuntu)

  1. git clone https://github.com/dlitz/pycrypto.git
  2. ./configure
  3. python setup.py build
  4. python setup.py install

and I made this test : python setup.py test Result there is no error but the problem comes here : in this file //paybox_signature.py//

# coding: utf-8
import urllib
import base64
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA

class Signature():

def verify(self, signature, msg, key):
    """ check if the signature is correct according to the public key path         given
        and the message """
    msg = self.remove_sign(msg)
    key = RSA.importKey(key)
    ha = SHA.SHA1Hash().new(msg)
    verifier = PKCS1_v1_5.new(key)
    signature = urllib.unquote(signature)
    signature = base64.b64decode(signature)
    return verifier.verify(ha, signature)

    def remove_sign(self, msg):
    """ remove signature arg from the given string"""
    pos = msg.find('&Signature')
    if pos == -1:
        return msg
    return msg[:pos] 

when I execute this line of the file :

from Crypto.PublicKey import RSA

--> It ok there is no error

when I do this

from Crypto.Signature import PKCS1_v1_5

--> Traceback (most recent call last): File "", line 1, in ImportError: No module named Signature

I don't know Why All the modules are there why python make this error !! really I don't know Please I need your help Thank you

J0e3gan
  • 8,740
  • 10
  • 53
  • 80
user3854643
  • 1
  • 1
  • 3

2 Answers2

1

Might be issue with the pycrypto package installation.

try with

sudo easy_install pycrypto

and than reboot your system.

You may also checkout api of pycrypto

If you use Mac OS than see more discussion here

Bhavesh Odedra
  • 10,990
  • 12
  • 33
  • 58
  • I tried this and it generate this error : Traceback (most recent call last): File "/usr/local/bin/easy_install", line 5, in from pkg_resources import load_entry_point File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2711, in parse_requirements(__requires__), Environment() File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve raise DistributionNotFound(req) pkg_resources.DistributionNotFound: setuptools>=0.7 – user3854643 Feb 13 '15 at 12:26
0

Its an old question but for people who are still looking for answer and stumbling upon this page. You can download the pyCrypto from pycrypto dist, but I recommend "pip install pyCrypto" as its simple and better.

Harry
  • 320
  • 1
  • 9