[Tutor] Converting \x0e to string 0e in python

Kent Johnson kent37 at tds.net
Fri Feb 9 06:19:11 CET 2007


Sudarshana KS wrote:
> Hi,
> 
> Currently i have data with the following type - Which is a x509 
> certificate obtained from SSL server done. I need this to be converted 
> to normal string, so that i can use the load_certificate method of 
> OpenSSL, which takes string as the argument.

The below data is a string. It contains lots of non-ascii values which 
are printed as \x escapes, but it is still a string. Have you tried 
passing it to load_certificate? What happened?

Kent

> 
> Kindly help me.
> 
> 
> cert= 
> '\x00\x01\xa20\x82\x01\x9e0\x82\x01(\x02\x01\x000\r\x06\t*\x86H\x86\xf7\r\x01\x01\x04\x05\x000:1
> \x120\x10\x06\x03U\x04\x03\x13\tConst2-2.1$0\n\x06\x03U\x04\x05\x13\x0339B0\x16\x06\t*\x86H\x86\xf7\r 
> 
> \x01\t\x02\x16\tConst2-2.0\x1e\x17\r070207210438Z\x17\r170204210438Z0:1\x120\x10\x06\x03U\x04\x03
> \x13\tConst2-2.1$0\n\x06\x03U\x04\x05\x13\x0339B0\x16\x06\t*\x86H\x86\xf7\r\x01\t\x02\x16\tConst2-2.0|0\r
> \x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03k\x000h\x02a\x00\xc2\x99e2\xd0\xa5\xb67\x80iv.\x12I\x17 
> 
> \xaa\xee9S\xdc\xee\xa1!\xb4\x94/\xf8\xe2\x0e%V\xdc\xa8%\x04\x03\x8dl\\\x8cJ\xec\x13\xd7\xe2\x96\x1b\xa8`
> \xdf$\xfe\xb9\x9a\xf9\xb7[\x8f\xe6\xc7U?&l\x04D\xfc\xd7\x96\x99\x04\xb1\x8c\xcd\xc3[\x17\xba\xb2+g5L
> \x08~3B\xf9\x1dV\x1a\x84\x0eW\x94\x1f\x02\x03\x01\x00\x010\r\x06\t*\x86H\x86\xf7\r\x01\x01\x04\x05 
> 
> \x00\x03a\x009f\x8c\xf8C\xcb0\xc8\x8e\xa2\xaeV\xc8 at .<\xae\xc7\xf6l\xeam2\x8f[Z\xde\xd0\xbf\xd7\xd1/
> \xbd\x14\x89\xd1 at s\x97\x02\x887\xcb\xf6#hNIG\xdb\x10\xe5A\x04\x19~8\x7f\xf3T\xaf\xdeY%\xc5if\xe4
> \x88\xce|v\xb2\xc35#\xc5\xa7\xec\xdca\x12\xd8*\xc3k\xf8\x911}!\x861\xe2;\xd7' 
> 
> 
> 
> -- 
> Regards,
> Sudarshana K S
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor




More information about the Tutor mailing list