Re: [pgAdmin4] Changes required to support PyCrypto

From: Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4] Changes required to support PyCrypto
Date: 2018-04-10 17:39:18
Message-ID: CAKKotZSwSPgxsVWNfxrKx_wCaeoAEOryhXkjYHH3MJRV-spLqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

​This is the exact code we had before pycrptodom changes, Is it fresh
virtual environment?
I suspect ​some conflicts from pycrptodom files.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Tue, Apr 10, 2018 at 9:51 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

>
>
> On Tue, Apr 10, 2018 at 4:51 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>
>> *grumble*. Thanks, applied.
>>
>
> And reverted. When I went back to 2.7, it got very upset:
>
> ERROR
> runTest (pgadmin.browser.server_groups.servers.databases.
> schemas.tables.tests.test_table_put.TableUpdateTestCase)
> Create partitions of existing range partitioned table ... 2018-04-10
> 17:10:57,703: ERROR pgadmin: Object type <type 'unicode'> cannot be
> passed to C code
> Traceback (most recent call last):
> File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/__init__.py",
> line 962, in connect
> if password is not None else server.password
> File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/crypto.py", line 31,
> in encrypt
> cipher = AES.new(pad(key), AES.MODE_CFB, iv)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/Crypto/Cipher/AES.py", line 200, in new
> return _create_cipher(sys.modules[__name__], key, mode, *args,
> **kwargs)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/Crypto/Cipher/__init__.py", line 55, in _create_cipher
> return modes[mode](factory, **kwargs)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/Crypto/Cipher/_mode_cfb.py", line 230, in _create_cfb_cipher
> cipher_state = factory._create_base_cipher(kwargs)
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/Crypto/Cipher/AES.py", line 100, in _create_base_cipher
> result = start_operation(c_uint8_ptr(key),
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/Crypto/Util/_raw_api.py", line 151, in c_uint8_ptr
> raise TypeError("Object type %s cannot be passed to C code" %
> type(data))
> TypeError: Object type <type 'unicode'> cannot be passed to C code
>
>
>
>>
>> On Tue, Apr 10, 2018 at 1:52 PM, Murtuza Zabuawala <
>> murtuza(dot)zabuawala(at)enterprisedb(dot)com> wrote:
>>
>>> On Tue, Apr 10, 2018 at 5:27 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>>
>>>>
>>>>
>>>> On Tue, Apr 10, 2018 at 12:49 PM, Murtuza Zabuawala <
>>>> murtuza(dot)zabuawala(at)enterprisedb(dot)com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Please find patch to revert back the changes we have made for
>>>>> pycryptodom module, This will fix encrypt & decrypt functionality in
>>>>> python3.
>>>>>
>>>>
>>>> Wait, what? Are you telling me that encrypt/decrypt is broken under
>>>> Python 3 in the builds I've just pushed?
>>>>
>>> ​Only if user's password contains non-ascii characters and running on
>>> Python3.​
>>>
>>>
>>>>
>>>> --
>>>> Dave Page
>>>> Blog: http://pgsnake.blogspot.com
>>>> Twitter: @pgsnake
>>>>
>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>> The Enterprise PostgreSQL Company
>>>>
>>>
>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Murtuza Zabuawala 2018-04-10 17:57:57 Re: [pgAdmin4][RM#3257] Fix for explain functionality
Previous Message Murtuza Zabuawala 2018-04-10 17:15:27 Re: pgAdmin 3.0 builds