Re: [pgAdmin4] Changes required to support PyCrypto

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

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.zabuawala@
> enterprisedb.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 Khushboo Vashi 2018-04-10 16:38:12 Re: pgAdmin 3.0 builds
Previous Message Dave Page 2018-04-10 16:12:32 pgAdmin 4 commit: Revert "Fix non-ASCII password decryption/encryption