Skip to content

Crypto error when encoding password: TypeError: Object type <class 'str'> cannot be passed to C code #131

@castrapel

Description

@castrapel

Hello,

On my Mac development machine, I'm receiving a crypto error encoding the password when I try to create a DynectSession. This works fine on our production Linux boxes.

Here's how I'm creating a DynectSession with customer name, username, and password (all strings),

dynect_session = DynectSession(
        "customer_name",
        "username",
        "password",
    )

Here's the traceback:

  File "env/lib/python3.6/site-packages/dyn/core.py", line 51, in __call__
    cur_thread: super(_Singleton, cls).__call__(*args, **kwargs)
  File "env/lib/python3.6/site-packages/dyn/tm/session.py", line 54, in __init__
    self.password = self.__cipher.encrypt(password)
  File "env/lib/python3.6/site-packages/dyn/encrypt.py", line 63, in encrypt
    return base64.b64encode(iv + cipher.encrypt(raw))
  File "env/lib/python3.6/site-packages/Crypto/Cipher/_mode_cbc.py", line 177, in encrypt
    c_uint8_ptr(plaintext),
  File "env/lib/python3.6/site-packages/Crypto/Util/_raw_api.py", line 134, in c_uint8_ptr
    raise TypeError("Object type %s cannot be passed to C code" % type(data))
TypeError: Object type <class 'str'> cannot be passed to C code

Library versions

dyn==1.8.1
cryptography==2.4.2
cffi==1.11.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions