skam wrote:


Hi guys,
I'm getting mad...
do you know how to read the userCertificate in binary format?
when I query the LDAP server with my python application I got something like...

'userCertificate;binary': ['0\x82\x05$0\x82\x04\x0c\xa0\x03\x02\x01\x02\x02\x01\x080\r\x06\t*\x86H\x86\xf7\r\x01\x01\x05\x05\x000-1\x0b0\t\x06\x03U\x04\x06\x13\x02IT1\r0\x0b\x06\x03U\x04\n\x13\x04INSC1\x0f0\r\x06\x03U\x04\x03\x13\x06inscCA0\x1e\x17\r060117223339Z\x17\r070117223339Z0F1\x0b0\t\x06\x03U\x04\x06\x13\x02IT1\r0\x0b\x06\x03U\x04\n\x13\x04INSC1\x120\x10\x06\x03U\x04\x0b\x13\tEmployees1\x140\x12\x06\x03U\x04\x03\x13\x0bmario rossi0\x82\x01"0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x01\x05\x00\x03\x82\x01\x0f\x000\x82\x01\n\x02\x82\x01\x01\x00\xb8\xf2Vb\xcb9\x0f#"#l\x1fW\xe3\x85\xe0\x1c\xb1\xee(\r\xbds\xac\x85\xbdK\x84\xc4"\xf1\xb7\xf6\xdf.\xdb\x10\x88\xa0\x01}v\xb9=F\xe7\xf0\xcd\xc7N\xa4\xa4\xd1\xc6\x8b>\xec\xed\xf1x%\x90,\xbaOJo\'\x12\x87.\xaa\xb2-|[EMAIL PROTECTED]/\x05\\\x14\xc1V[\x10Qb\xdaC=\xd2G\xfa\xf9U\xc6i\x99\xb6\xd6\xda,\x9b\x1d\xe0\xc3[\x98\xdf\xd4{\x96drd\x04d=JO{\xb7;!\x11\x9fCr\xb8\x1b\x8aQ\x83(p\xab(\x02\xa0\xff\x81\xa3\xe3\xa9\xf5\\dUXE\x90,\xed\xa6\x94[u\x18M\x8b\x19\x15\x02\x00\x17\xf0H{\xc0\xd3\xa8D\xd4\xab\xce\x9b\xe3\xfby\xd0\xea\xfc\x01\xc3Z\xba\xb1R2\xb7\x83LL\xc9Dl\x80\xb7\x00\x17\xdf<@\xe3B\xf3\x99TjF\xe5PJ\x04\x99\x18\x0bL1\x9f\xf1vN\xe2\x97\xfd\x02\x03\x01\x00\x01\xa3\x82\x0240\x82\x0200\t\x06\x03U\x1d\x13\x04\x020\x0008\x06\x03U\x1d \x0410/0-\x06\x04*\x03\x03\x040%0#\x06\x08+\x06\x01\x05\x05\x07\x02\x01\x16\x17http://some.url.org/cps0\x11\x06\t`\x86H\x01\x86\xf8B\x01\x01\x04\x04\x03\x02\x05\xa00\x0b\x06\x03U\x1d\x0f\x04\x04\x03\x02\x05\xe00)\x06\x03U\x1d%\x04"0 \x06\x08+\x06\x01\x05\x05\x07\x03\x02\x06\x08+\x06\x01\x05\x05\x07\x03\x04\x06\n+\x06\x01\x04\x01\x827\x14\x02\x020\'\x06\t`\x86H\x01\x86\xf8B\x01\r\x04\x1a\x16\x18User Certificate of INSC0\x1d\x06\x03U\x1d\x0e\x04\x16\x04\x14k\x16\xa2U\xfa}\x99\x9dj\xffv4\x0b\x12\x19\x99\xd9\xda\xe2\r0]\x06\x03U\x1d#\x04V0T\x80\x14\x7f\xe5p\x850\x8f\x82\'k\xd8\xf3o\xc0`u?]C\xe2O\xa11\xa4/[EMAIL PROTECTED],\x16*http://www.inscdomain.it/pub/crl/cacrl.crl09\x06\t`\x86H\x01\x86\xf8B\x01\x03\x04,\x16*http://www.inscdomain.it/pub/crl/cacrl.crl0;\x06\x03U\x1d\x1f\x0440200\xa0.\xa0,\x86*http://www.inscdomain.it/pub/crl/cacrl.crl0\r\x06\t*\x86H\x86\xf7\r\x01\x01\x05\x05\x00\x03\x82\x01\x01\x00\xaf\x7fb\xa8\xed\x81\xc1b\xd9\xba96\x1c\xf1\x8cwl\x85k\xd7C\x06\xb2\xe7\x16{qI\x1bh[\xda\x9a\x06\r\x18_>[EMAIL PROTECTED]<\xc8\t\xa2g\xf6\xf7\x0ez=\xe4\x18\xd6\xb0\x9f\xb7\x04~a\x86\xca\xfd\xca\x9bN\xb1\x962\xfaMO\xa8\'\xef]\x83v\xb6N\xf9\xeb\xd4GM&\xfc\xbc;\xc6\x9c\xa1^&\x11\x98\xcdT\xf4\xaa\xd3+\xb8a\x9ex)\x89\x88\x7f\xbe\x07Msg\x00\x0f\x14\xc0\x8b\xee\xdcU\x88Z\x01Q G$\x91\xef\xecJu5DFY\xc5u\xe2\x80-\xd7sX\xc2!U\xdc3\x9e*x"[EMAIL PROTECTED]/:j[\x19\xd6\xa2\xff\xbbQ\xbf\xf77\xe4l\xf4\xbf\x08C']

I only need to extract the publicKey
can you tell me how?

Have you tried saving the binary data in a file and handle it with "openssl x509 -inform DER"? Or creating a memory BIO with the data and feed it to the corresponding API-functions? Then you should have a certificate and if it's really just the public key you need you can extract it from that.

I have done something similar successfully with a result of ldapsearch.


Thanks a lot
Bye
Giuseppe

Hope it helps.
Ted
;)

--
PGP Public Key Information
Download complete Key from http://www.convey.de/ted/tedkey_convey.asc
Key fingerprint = 31B0 E029 BCF9 6605 DAC1  B2E1 0CC8 70F4 7AFB 8D26


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to