help for using Python rsa

Cameron Simpson cs at zip.com.au
Sat Feb 7 21:55:37 EST 2015


On 07Feb2015 18:15, Chris Angelico <rosuav at gmail.com> wrote:
>On Sat, Feb 7, 2015 at 4:14 PM,  <mhr1224 at gmail.com> wrote:
>> encrypted massage is like this:
>> "@\xc4\xb2\x14r\xf1x\xb8\xb2\t;\x9a:\x1dl\x11\xe2\x10\xa9E\xee\x8b\xac\xd0\xd3Y\xfb}\xd9@\xdd\x0c\xa5\xd2\xfc1\xd6\x06\xf0\xb8\x944\xe1\xc2r\xe5anyq\xac\xdfh\xeb\x10\x80\x98\xa1\xee'\xe6hpi"
>>
>> and i know it should be like this:
>> SEcPB1mYNrfeE4zP4RI3z2K4Rh9HDNfPhuF28IyxHFjEOJ9Z+1zdIwPF0jsJGQDJyKpAju7dcYueHHXXeH8d+w==
>>
>> How can i change the format of this?
>
>That looks like Base 64 encoded text, which you can easily produce
>from Python. But that isn't the base-64 encoded version of the above
>binary blob.

Indeed:

  >>> base64.b64decode('SEcPB1mYNrfeE4zP4RI3z2K4Rh9HDNfPhuF28IyxHFjEOJ9Z+1zdIwPF0jsJGQDJyKpAju7dcYueHHXXeH8d+w==')
  'HG\x0f\x07Y\x986\xb7\xde\x13\x8c\xcf\xe1\x127\xcfb\xb8F\x1fG\x0c\xd7\xcf\x86\xe1v\xf0\x8c\xb1\x1cX\xc48\x9fY\xfb\\\xdd#\x03\xc5\xd2;\t\x19\x00\xc9\xc8\xaa@\x8e\xee\xddq\x8b\x9e\x1cu\xd7x\x7f\x1d\xfb'

But as you say, it is base64 compatible. Maybe the 'SEcP...' string is base64 
encoding of some encapsulation of the encrypted string?

>Are you asking how to base-64 something, or are you specifically
>expecting that output?

Given that Dave Angel has a tool that displays the 'SEcP...' string using 
mhr1224's input string, I'd say we're missing some context.

Cheers,
Cameron Simpson <cs at zip.com.au>

You my man are a danger to society and should be taken out of society for all
our sakes. As to what is done to you once removed I couldn't care less.
        - Roy G. Culley, Unix Systems Administrator



More information about the Python-list mailing list