Zymkey command exception


#1

Hi, I just received a I2C zymkey. I am using a Raspberry Pi 3 with ethernet connection and a I2C connected zymkey.

I followed the get started guide and zymkey installed correctly (the led is in fixed blue and in the console everything is ok).

The problem is when i tried the Zymkey: Create a LUKS-encrypted disk volume tutorial.
When i wrote in the console:

zymkey filesystem_create zkfs /zkfs -a

first it said zymkey command not found

Then i installed

sudo pip install zymkey

And if i try to do the same thing for de LUKS-encrypted disk volume it throws this exception:

Traceback (most recent call last):
File “/usr/local/bin/zymkey”, line 7, in
from zymkey.entrypoints import main
File “/usr/local/lib/python2.7/dist-packages/zymkey/init.py”, line 3, in
from .module import Zymkey
File “/usr/local/lib/python2.7/dist-packages/zymkey/module.py”, line 50, in
raise ZymkeyLibraryError(‘unable to find {}, checked {}’.format(os.path.basename(ZYMKEY_LIBRARY_PATH), prefixes))
zymkey.exceptions.ZymkeyLibraryError: unable to find libzk_app_utils.so, checked [’/usr/lib/python2.7/dist-packages/usr/local/lib’, ‘/usr/local/lib’]

Also this files does not exist:

python /usr/local/share/zymkey/examples/zk_app_utils_test.py
python /usr/local/share/zymkey/examples/zk_crypto_test.py

The folder /usr/local/share/zymkey does not exists.

How can I install libzk_app_utils.so?

Maybe I am doing something wrong.
Thanks for the help!


#2

@davidproc apologies for the late reply. As I am trying to reproduce your error, please run an update on the zymkey pypi package:
sudo pip install -U zymkey
and confirm version 1.1
Best,
Evan


#3

I made the steps again in a new installation, i think the first time i forgot to ssh local but now I get this error when I try to use python API.

pi@raspberrypicb:~ $ sudo python
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import zymkey
>>> z = zymkey.Zymkey()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/zymkey/module.py", line 62, in __init__
    raise AssertionError('bad return code {!r}'.format(ret))
AssertionError: bad return code -16

The installed version seems to be 0.1.1
I just did this:

Proceed (y/n)? y
  Successfully uninstalled zymkey-0.1.1
pi@raspberrypicb:~ $ sudo pip install zymkey 1.1
Collecting zymkey
Collecting 1.1
  Could not find a version that satisfies the requirement 1.1 (from versions: )
No matching distribution found for 1.1
pi@raspberrypicb:~ $ sudo pip install zymkey-1.1
Collecting zymkey-1.1
  Could not find a version that satisfies the requirement zymkey-1.1 (from versions: )
No matching distribution found for zymkey-1.1
pi@raspberrypicb:~ $ sudo pip install zymkey
Collecting zymkey
Requirement already satisfied: sh>=1.11 in /usr/local/lib/python2.7/dist-packages (from zymkey)
Requirement already satisfied: cmdline>=0.1.8 in /usr/local/lib/python2.7/dist-packages (from zymkey)
Requirement already satisfied: PyYAML>=3 in /usr/local/lib/python2.7/dist-packages (from cmdline>=0.1.8->zymkey)
Installing collected packages: zymkey
Successfully installed zymkey-0.1.1
pi@raspberrypicb:~ $ sudo pip install -U zymkey
Requirement already up-to-date: zymkey in /usr/local/lib/python2.7/dist-packages
Requirement already up-to-date: sh>=1.11 in /usr/local/lib/python2.7/dist-packages (from zymkey)
Requirement already up-to-date: cmdline>=0.1.8 in /usr/local/lib/python2.7/dist-packages (from zymkey)
Requirement already up-to-date: PyYAML>=3 in /usr/local/lib/python2.7/dist-packages (from cmdline>=0.1.8->zymkey)

The zymkey LED is in solid blue and in the console the heartbeat is up to date.


#4

Hi David,
When you get a chance try this in a new python shell:

pi@unicornpi:~ $ python
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import zymkey
>>> z = zymkey.client
>>> z.lock(bytearray('hello world'))
 bytearray(b'L\xbe\x0f\x00\x00\x00\\b0\xc4;\xa4.\xec~\x1bmr<\xe3\xde2D%f\x96y\xd7\x82\x9a\x0b\xa3A\xf9U\x9eO\x86\x15^\xdb\x1c\xf2\x90\xfc\x02\xd5\x1d>#\x03k\xb1[\x94\xee\x0e\x14\x88\xe3\x17e\x07\xdcGr\xf7\xa3\xf1n\xe0W\x13\xfd5e\x92\x8a\xab^Xm\x96\xb3`|x\xcd')

The zymkey.Zymkey() object is not callable, and may be the issue you are experiencing. The class call tries to open a session and gets interrupted by the exception.

Also, there is a typo in the parent directory python /usr/local/share/zymkey/exmaples/ …doh! This will be fixed in the next push. The sample scripts should be located here:

pi@unicornpi:~ $ ls /usr/local/share/zymkey/exmaples/
zk_app_utils_test.py  zk_crypto_test.py

Thank you for bringing these issues to my attention. Let me know if problems persist. I would be happy to set up a screen share session if you think that would be helpful.

Best,
Evan


#5

Now everything is working correctly and i have the examples.
I will continue working using the device.

Thanks for the help. :thumbsup::slight_smile:


#6

#7