Type error when loading application

Open
#25 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Start in hexLoader.py at the Python 3 compatibility change referenced in the issue, then trace the encryptAES call from loadApp.py. Reproduce the failure with Python 2.7 and verify that loading an application works there while retaining Python 3 compatibility.

Written by the indexing model from the issue text.

Description

Information

  • Python 2.7.6
  • ledgerblue 1.1.16

Description

When loading an application on the ledger, I am seeing the following error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/ledgerblue/loadApp.py", line 174, in <module>
    loader.createApp(args.appFlags, appLength, args.appName, icon, path, None, None, args.appVersion)
  File "/usr/local/lib/python2.7/dist-packages/ledgerblue/hexLoader.py", line 163, in createApp
    data = self.encryptAES(data)
  File "/usr/local/lib/python2.7/dist-packages/ledgerblue/hexLoader.py", line 95, in encryptAES
    encryptedData = cipher.encrypt(paddedData)
  File "/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py", line 244, in encrypt
    return self._cipher.encrypt(plaintext)
TypeError: argument must be string or read-only buffer, not bytearray
make: *** [load] Error 1

This appears to be due to the change to hexLoader.py here https://github.com/LedgerHQ/blue-loader-python/commit/ed1e3a4dac54bbc3f0e6d0fa539199c889f92b6c for Python 3 compatibility, which unfortunately does not with python 2.7.x.

Version 0.1.15 works correctly and as intended.

Dominant language
Python
Stars
125
Forks
75
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from LedgerHQ/blue-loader-python

All issues in LedgerHQ/blue-loader-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.