warner / python-ed25519

Python bindings to the Ed25519 public-key signature system
Other
164 stars 38 forks source link

MemoryError #12

Open marcelomanzo opened 7 years ago

marcelomanzo commented 7 years ago

JMSwag asked me to report this error here (Please report to python-ed25519. I get the same error when I execute ed25519 from the repl.), this is in reference of the fololwing issue: https://github.com/JMSwag/PyUpdater/issues/45?_pjax=%23js-repo-pjax-container

How to reproduce:

pip install -U https://github.com/JMSwag/PyUpdater/tarball/master

Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

C:\Users\marce\repo\nextgendash>pyupdater keys -c 99 INFO: PyUpdater 0+unknown [INFO] PyUpdater 0+unknown 99 DEBUG: PyUpdater config data folder is missing 99 ERROR: Not a PyUpdater repo: You must initialize your repository first [ERROR] Not a PyUpdater repo: You must initialize your repository first Please enter app name - No Default Available --> SimRacingDash 5604 DEBUG: Under None You entered SimRacingDash, is this correct? [N/y]?y 8082 DEBUG: Must be true 8098 ERROR: [ERROR] 8098 DEBUG: Traceback (most recent call last): File "c:\users\marce\appdata\local\programs\python\python36\lib\site-packages\pyupdater\key_handler\keys.py", line 99, in _gen_keypack app_pri, app_pub = self._make_keys() File "c:\users\marce\appdata\local\programs\python\python36\lib\site-packages\pyupdater\key_handler\keys.py", line 150, in _make_keys privkey, pubkey = ed25519.create_keypair() File "c:\users\marce\appdata\local\programs\python\python36\lib\site-packages\ed25519\keys.py", line 10, in create_keypair sk = SigningKey(seed) File "c:\users\marce\appdata\local\programs\python\python36\lib\site-packages\ed25519\keys.py", line 85, in init vk_s, sk_s = _ed25519.publickey(sk_s) MemoryError 8098 ERROR: Failed to create keypair; please report this issue on https://github.com/JMSwag/PyUpdater/issues [ERROR] Failed to create keypair; please report this issue on https://github.com/JMSwag/PyUpdater/issues 8098 ERROR: Failed to create keypack [ERROR] Failed to create keypack

C:\Users\marce\repo\nextgendash>

soundstripe commented 6 years ago

I'm having the same issue--

Steps to reproduce:

>>> import ed25519
>>> ed25519.create_keypair()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\py_jamberry_api\lib\site-packages\ed25519\keys.py", line 10, in create_keypair
    sk = SigningKey(seed)
  File "C:\Users\user\py_jamberry_api\lib\site-packages\ed25519\keys.py", line 85, in __init__
    vk_s, sk_s = _ed25519.publickey(sk_s)
MemoryError
wolfamongus2 commented 6 years ago

@soundstripe @marcelomanzo Same here, any idea how to fix? To be fair I couldn't create any keys so I did: if ns.create is True and False: Rather than just True log.error('You can not create off-line keys on your dev machine') return

corneyl commented 6 years ago

Same problem here, using Windows 10 and the stellar-base package.

$ python --version
Python 3.6.0 :: Continuum Analytics, Inc.

Traceback:

Traceback (most recent call last):
  File ".\generate.py", line 3, in <module>
    kp = Keypair.random()
  File "C:\ProgramData\Miniconda3\lib\site-packages\stellar_base\keypair.py", line 40, in random
    return cls.from_raw_seed(seed)
  File "C:\ProgramData\Miniconda3\lib\site-packages\stellar_base\keypair.py", line 53, in from_raw_seed
    signing_key = ed25519.SigningKey(raw_seed)
  File "C:\ProgramData\Miniconda3\lib\site-packages\ed25519\keys.py", line 85, in __init__
    vk_s, sk_s = _ed25519.publickey(sk_s)
MemoryError
acaspy commented 6 years ago

same problem here stellar-base on win10 python 3.6.4

signing_key = ed25519.SigningKey(raw_seed) File "C:\Users\acaspy\ticketfactory\venv\lib\site-packages\ed25519\keys.py", line 85, in __init__ vk_s, sk_s = _ed25519.publickey(sk_s) MemoryError

wbinek commented 6 years ago

Same problem, Windows 10, python 3.6.4. Is there any idea how to fix it?

acaspy commented 6 years ago

moved to python 2.7.12

2018-03-12 12:17 GMT+02:00 wbinek notifications@github.com:

Same problem, Windows 10, python 3.6.4. Is there any idea how to fix it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/warner/python-ed25519/issues/12#issuecomment-372258720, or mute the thread https://github.com/notifications/unsubscribe-auth/AQhOqQ4XzAyo33J5wUA0ClQedECJTzS2ks5tdksqgaJpZM4Pp2Lg .

flutefreak7 commented 5 years ago

I'm getting the same as OP with PyUpdater.

I am on Windows 10, Python 3.7.2 from Anaconda.

I can do one of the above examples fine:

>>> ed25519.create_keypair()
(<ed25519.keys.SigningKey at 0x2684de57160>, <ed25519.keys.VerifyingKey at 0x2684de57208>)

But I get the same error as OP with the call to publickey.

Here's a bit of PyUpdater code that leads to the error:

def _add_sig(self):
    # Adding new signature to version file
    # Raw private key will need to be converted into
    # a signing key object
    private_key_raw = self._load_private_keys()
    if private_key_raw is None:
        log.error('Private Key not found. Please '
                  'import a keypack & try again')
        return

    # Load update manifest
    update_data = self._load_update_data()

    # We don't want to verify the signature
    if 'signature' in update_data:
        log.debug('Removing signatures from version file')
        del update_data['signature']

    # We create a signature from the string
    update_data_str = json.dumps(update_data, sort_keys=True)

    private_key_raw = private_key_raw.encode('utf-8')

    # Creating signing key object
    private_key = ed25519.SigningKey(private_key_raw,
                                     encoding=self.key_encoding)

This makes me wonder if it's something with the inputs to SigningKey - either the private_key_raw or the key_encoding. key_encoding is set to 'base64'.

hitwill commented 5 years ago

moved to python 2.7.12 2018-03-12 12:17 GMT+02:00 wbinek notifications@github.com: Same problem, Windows 10, python 3.6.4. Is there any idea how to fix it? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#12 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AQhOqQ4XzAyo33J5wUA0ClQedECJTzS2ks5tdksqgaJpZM4Pp2Lg .

Downgraded to Python 3.6.0 and this solved it for me.

okready commented 5 years ago

I opened a PR (#14) for what I believe fixes the issue. It seems to only occur with 64-bit versions of Python on Windows; 32-bit versions of Python (regardless of whether Windows itself is 32-bit or 64-bit) appear to be unaffected by the bug.

For anyone who tried downgrading, do you recall whether you switched to a 32-bit version of Python in the process?

warner commented 5 years ago

I just released version 1.5 with that fix.. sorry it took so long. Could someone with an affected system give the new version a try and let me know if it works now?

JMSwag commented 5 years ago

@warner 1.5 works without issue. Thanks!

Windows 10 Python 64bit