[python-ldap] AD objectGUID conversion to string
Michael Ströder
michael at stroeder.com
Tue Sep 23 21:57:56 CEST 2014
Joseph L. Casale wrote:
>> here is an example of the output of the
>> objectGUID query: '\xd3\x18W|T\xc4!A\x90\xe3\xa7\xf7\xe8\xe1\xd9\xf1'
>> Can anyone confirm what this format is?
>
> As Michaels code illustrated, the value is byte encoded.
Yes, the LDAP syntax of 'objectGUID' is simply OctetString.
> Data in AD is typically utf-16 encoded.
No! The LDAP interface of MS AD is LDAPv3 compliant and therefore uses UTF-8
for LDAP syntax DirectoryString.
> The "\xnn" notation is hexadecimal values, see string literals in the Python docs.
>
> In [1]: import uuid
>
> In [2]: s = b'\xd3\x18W|T\xc4!A\x90\xe3\xa7\xf7\xe8\xe1\xd9\xf1'
>
> In [3]: uuid.UUID(bytes_le=s)
> Out[3]: UUID('7c5718d3-c454-4121-90e3-a7f7e8e1d9f1')
Yupp!
Ciao, Michael.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2398 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20140923/af5aff25/attachment.bin>
More information about the python-ldap
mailing list