// Token: 0x0600095C RID: 2396 RVA: 0x00029848 File Offset: 0x00027A48
        internal static List <Tuple <string, KeyType> > GetAddKeysFromADRawEntry(ADRawEntry adEntry)
        {
            ArgumentValidator.ThrowIfNull("adEntry", adEntry);
            List <Tuple <string, KeyType> > list = new List <Tuple <string, KeyType> >();

            if (adEntry.Id != null && !string.IsNullOrEmpty(adEntry.Id.DistinguishedName))
            {
                list.Add(new Tuple <string, KeyType>(adEntry.Id.DistinguishedName.ToLower(), KeyType.DistinguishedName));
            }
            if (adEntry.Id != null && !adEntry.Id.ObjectGuid.Equals(Guid.Empty))
            {
                list.Add(new Tuple <string, KeyType>(adEntry.Id.ObjectGuid.ToString(), KeyType.Guid));
            }
            SecurityIdentifier securityIdentifier = (SecurityIdentifier)adEntry[IADSecurityPrincipalSchema.Sid];

            if (securityIdentifier != null)
            {
                list.Add(KeyBuilder.LookupKeysFromSid(securityIdentifier));
            }
            Guid guid = (Guid)adEntry[ADMailboxRecipientSchema.ExchangeGuid];

            if (!Guid.Empty.Equals(guid))
            {
                list.Add(KeyBuilder.LookupKeysFromExchangeGuid(guid, false, false));
            }
            ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)adEntry[ADRecipientSchema.EmailAddresses];

            if (proxyAddressCollection != null)
            {
                foreach (ProxyAddress proxyAddress in proxyAddressCollection)
                {
                    list.AddRange(KeyBuilder.LookupKeysFromProxyAddress(proxyAddress));
                }
            }
            NetID netID = (NetID)adEntry[ADUserSchema.NetID];

            if (netID != null)
            {
                list.Add(KeyBuilder.LookupKeysFromNetId(netID.ToString()));
            }
            return(list);
        }
        // Token: 0x0600095D RID: 2397 RVA: 0x000299C8 File Offset: 0x00027BC8
        internal static List <Tuple <string, KeyType> > GetAddKeysFromObject(ADObject adObject)
        {
            ArgumentValidator.ThrowIfNull("adObject", adObject);
            ObjectType objectTypeFor             = CacheUtils.GetObjectTypeFor(adObject.GetType(), true);
            List <Tuple <string, KeyType> > list = new List <Tuple <string, KeyType> >();

            if (!string.IsNullOrEmpty(adObject.DistinguishedName))
            {
                list.Add(new Tuple <string, KeyType>(adObject.DistinguishedName.ToLower(), KeyType.DistinguishedName));
            }
            if (!Guid.Empty.Equals(adObject.Guid))
            {
                list.Add(new Tuple <string, KeyType>(adObject.Guid.ToString(), KeyType.Guid));
            }
            ObjectType objectType = objectTypeFor;

            if (objectType <= ObjectType.OWAMiniRecipient)
            {
                if (objectType <= ObjectType.FederatedOrganizationId)
                {
                    switch (objectType)
                    {
                    case ObjectType.ExchangeConfigurationUnit:
                        list.Add(new Tuple <string, KeyType>(adObject.Id.Parent.Name, KeyType.Name));
                        list.Add(new Tuple <string, KeyType>(((ExchangeConfigurationUnit)adObject).ExternalDirectoryOrganizationId, KeyType.ExternalDirectoryOrganizationId));
                        return(list);

                    case ObjectType.Recipient:
                    {
                        list.AddRange(KeyBuilder.GetSidKeys(adObject));
                        list.AddRange(KeyBuilder.GetExchangeGuidKeys(adObject));
                        string text = (string)adObject[ADRecipientSchema.LegacyExchangeDN];
                        if (!string.IsNullOrEmpty(text))
                        {
                            list.Add(new Tuple <string, KeyType>(text, KeyType.LegacyExchangeDN));
                        }
                        list.AddRange(KeyBuilder.GetExchangeEmailAddressesKeys(adObject));
                        return(list);
                    }

                    case ObjectType.ExchangeConfigurationUnit | ObjectType.Recipient:
                        return(list);

                    case ObjectType.AcceptedDomain:
                        list.Add(new Tuple <string, KeyType>(adObject.Name, KeyType.Name));
                        return(list);

                    default:
                        if (objectType != ObjectType.FederatedOrganizationId)
                        {
                            return(list);
                        }
                        list.Add(new Tuple <string, KeyType>(adObject.Id.Parent.DistinguishedName, KeyType.OrgCUDN));
                        return(list);
                    }
                }
                else
                {
                    if (objectType == ObjectType.MiniRecipient)
                    {
                        if ((adObject as MiniRecipient).NetID != null)
                        {
                            list.Add(KeyBuilder.LookupKeysFromNetId((adObject as MiniRecipient).NetID.ToString()));
                        }
                        ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)adObject[ADRecipientSchema.EmailAddresses];
                        if (proxyAddressCollection != null)
                        {
                            foreach (ProxyAddress proxyAddress in proxyAddressCollection)
                            {
                                list.AddRange(KeyBuilder.LookupKeysFromProxyAddress(proxyAddress));
                            }
                        }
                        list.AddRange(KeyBuilder.GetSidKeys(adObject));
                        return(list);
                    }
                    if (objectType != ObjectType.TransportMiniRecipient && objectType != ObjectType.OWAMiniRecipient)
                    {
                        return(list);
                    }
                }
            }
            else if (objectType <= ObjectType.StorageMiniRecipient)
            {
                if (objectType != ObjectType.ActiveSyncMiniRecipient && objectType != ObjectType.StorageMiniRecipient)
                {
                    return(list);
                }
            }
            else if (objectType != ObjectType.LoadBalancingMiniRecipient)
            {
                if (objectType == ObjectType.MiniRecipientWithTokenGroups)
                {
                    list.AddRange(KeyBuilder.GetSidKeys(adObject));
                    return(list);
                }
                if (objectType != ObjectType.FrontEndMiniRecipient)
                {
                    return(list);
                }
                list.AddRange(KeyBuilder.GetExchangeGuidKeys(adObject));
                return(list);
            }
            ProxyAddressCollection proxyAddressCollection2 = (ProxyAddressCollection)adObject[ADRecipientSchema.EmailAddresses];

            if (proxyAddressCollection2 != null)
            {
                foreach (ProxyAddress proxyAddress2 in proxyAddressCollection2)
                {
                    list.AddRange(KeyBuilder.LookupKeysFromProxyAddress(proxyAddress2));
                }
            }
            list.AddRange(KeyBuilder.GetSidKeys(adObject));
            return(list);
        }