# How to encode Active Directory objctGUID to a readble string?

**URL:** <https://techcommunity.softwareag.com/t/how-to-encode-active-directory-objctguid-to-a-readble-string/303553>\
**Category:** Forum\
**Tags:** Adabas-Natural, CONNX\
**Created:** [December 2, 2024, 8:33am UTC](https://techcommunity.softwareag.com/t/how-to-encode-active-directory-objctguid-to-a-readble-string/303553 "2024-12-02T08:33:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Gruben](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Martin\_Gruben](https://techcommunity.softwareag.com/u/Martin_Gruben)\
**Post date:** [December 2, 2024, 8:33am UTC](https://techcommunity.softwareag.com/t/how-to-encode-active-directory-objctguid-to-a-readble-string/303553/1 "2024-12-02T08:33:18Z")

</div>

#### _ **Product/components** used and **version/fix** level:_

webMethods 10.15

#### _Detailed explanation of the problem:_

I can rertieve all the user Data from our AD and the objectGUID is in an unreadable format.

Like this: ������M�a�C��u

i put this into pub.string:string to bytes  
[B@3df42815

after that i put this into pub.string.base64Encode  
Pz8/Pz8VP00/BxQ/Qz8/dQ==

after that i put it into this java service:

````
```
          IDataCursor pipelineCursor = pipeline.getCursor();
			String	inString = IDataUtil.getString( pipelineCursor, "inString" );
				
			pipelineCursor.destroy();
	
	byte[] decodedBytes = Base64.getDecoder().decode(inString);
	
	// Convert byte array to UUID
	long mostSigBits = 0;     
	long leastSigBits = 0;
	for (int i = 0; i < 8; i++) {
	mostSigBits = (mostSigBits << 8) | (decodedBytes[i] & 0xff);
	}
	for (int i = 8; i < 16; i++) {
	leastSigBits = (leastSigBits << 8) | (decodedBytes[i] & 0xff);
	}
	UUID uuid = new UUID(mostSigBits, leastSigBits);
	
	// System.out.println("Decoded UUID: " + uuid.toString());
	
	String objectGUID = uuid.toString();
	
	// pipeline
	IDataCursor pipelineCursor_1 = pipeline.getCursor();
	IDataUtil.put( pipelineCursor_1, "objectGUID", objectGUID );
	pipelineCursor_1.destroy();
}

````

´´´  
i got this, but this is not the correct objectGUID of this User.

3f3f3f3f-3f15-3f4d-3f07-143f433f3f75

The correct one is

A9FAC0CD-1580-4D86-8407-1481438DAA75

it looks different.

How i can retrieve the correct objectGUID from active directory???

---

<div class="post-metadata">

**Author:** ![Holger\_von\_Thomsen](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/holger_von_thomsen/32/178_2.png) [@Holger\_von\_Thomsen](https://techcommunity.softwareag.com/u/Holger_von_Thomsen)\
**Post date:** [December 2, 2024, 10:09am UTC](https://techcommunity.softwareag.com/t/how-to-encode-active-directory-objctguid-to-a-readble-string/303553/2 "2024-12-02T10:09:54Z")

</div>

Hi Martin,

might it be that the directory returns the GUID in a somehow already coded manner, which needs to be decoded first before base64-encoding it?

Regards,  
Holger

---

<div class="post-metadata">

**Author:** ![Martin\_Gruben](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Martin\_Gruben](https://techcommunity.softwareag.com/u/Martin_Gruben)\
**Post date:** [December 2, 2024, 1:26pm UTC](https://techcommunity.softwareag.com/t/how-to-encode-active-directory-objctguid-to-a-readble-string/303553/3 "2024-12-02T13:26:16Z")

</div>

Hello Holger,

the objectGUID ist BASE64 coded and I retrieve it with pub.client.ldap:search as string.

objectGUID = �����\_�M�\_\_�C��u

That i need as readable string.

Regards

Martin

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [May 31, 2025, 1:26pm UTC](https://techcommunity.softwareag.com/t/how-to-encode-active-directory-objctguid-to-a-readble-string/303553/4 "2025-05-31T13:26:17Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
