Beispiel #1
0
        internal void ContributeFragment(byte msg_type, int length, byte[] buf, int off, int fragment_offset, int fragment_length)
        {
            int num = fragment_offset + fragment_length;

            if (mMsgType != msg_type || mBody.Length != length || num > length)
            {
                return;
            }
            if (fragment_length == 0)
            {
                if (fragment_offset == 0 && ((global::System.Collections.ICollection)mMissing).get_Count() > 0)
                {
                    Range range = (Range)mMissing.get_Item(0);
                    if (range.End == 0)
                    {
                        mMissing.RemoveAt(0);
                    }
                }
                return;
            }
            for (int i = 0; i < ((global::System.Collections.ICollection)mMissing).get_Count(); i++)
            {
                Range range2 = (Range)mMissing.get_Item(i);
                if (range2.Start >= num)
                {
                    break;
                }
                if (range2.End <= fragment_offset)
                {
                    continue;
                }
                int num2 = Math.Max(range2.Start, fragment_offset);
                int num3 = Math.Min(range2.End, num);
                int num4 = num3 - num2;
                global::System.Array.Copy((global::System.Array)buf, off + num2 - fragment_offset, (global::System.Array)mBody, num2, num4);
                if (num2 == range2.Start)
                {
                    if (num3 == range2.End)
                    {
                        mMissing.RemoveAt(i--);
                    }
                    else
                    {
                        range2.Start = num3;
                    }
                    continue;
                }
                if (num3 != range2.End)
                {
                    mMissing.Insert(++i, (object)new Range(num3, range2.End));
                }
                range2.End = num2;
            }
        }
Beispiel #2
0
 private static void RemoveAt10(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, int index)
 {
     // (I)V
     // (I)V
     global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
     try {
         global::System.Collections.IList @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C <global::System.Collections.IList>(@__env, @__obj);
         @__real.RemoveAt(index);
     }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); }
 }
Beispiel #3
0
        public static PgpSecretKeyRing RemoveSecretKey(PgpSecretKeyRing secRing, PgpSecretKey secKey)
        {
            global::System.Collections.IList list = Platform.CreateArrayList((global::System.Collections.ICollection)secRing.keys);
            bool flag = false;

            for (int i = 0; i < ((global::System.Collections.ICollection)list).get_Count(); i++)
            {
                PgpSecretKey pgpSecretKey = (PgpSecretKey)list.get_Item(i);
                if (pgpSecretKey.KeyId == secKey.KeyId)
                {
                    flag = true;
                    list.RemoveAt(i);
                }
            }
            if (!flag)
            {
                return(null);
            }
            return(new PgpSecretKeyRing(list, secRing.extraPubKeys));
        }
Beispiel #4
0
        public static PgpPublicKey RemoveCertification(PgpPublicKey key, PgpSignature certification)
        {
            PgpPublicKey pgpPublicKey = new PgpPublicKey(key);

            global::System.Collections.IList list = ((pgpPublicKey.subSigs != null) ? pgpPublicKey.subSigs : pgpPublicKey.keySigs);
            int  num  = list.IndexOf((object)certification);
            bool flag = num >= 0;

            if (flag)
            {
                list.RemoveAt(num);
            }
            else
            {
                {
                    global::System.Collections.IEnumerator enumerator = key.GetUserIds().GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            string id = (string)enumerator.get_Current();
                            {
                                global::System.Collections.IEnumerator enumerator2 = key.GetSignaturesForId(id).GetEnumerator();
                                try
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        object current = enumerator2.get_Current();
                                        if (certification == current)
                                        {
                                            flag         = true;
                                            pgpPublicKey = RemoveCertification(pgpPublicKey, id, certification);
                                        }
                                    }
                                }
                                finally
                                {
                                    global::System.IDisposable disposable2 = enumerator2 as global::System.IDisposable;
                                    if (disposable2 != null)
                                    {
                                        disposable2.Dispose();
                                    }
                                }
                            }
                        }
                    }
                    finally
                    {
                        global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                }
                if (!flag)
                {
                    global::System.Collections.IEnumerator enumerator = key.GetUserAttributes().GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            PgpUserAttributeSubpacketVector userAttributes = (PgpUserAttributeSubpacketVector)enumerator.get_Current();
                            {
                                global::System.Collections.IEnumerator enumerator2 = key.GetSignaturesForUserAttribute(userAttributes).GetEnumerator();
                                try
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        object current2 = enumerator2.get_Current();
                                        if (certification == current2)
                                        {
                                            flag         = true;
                                            pgpPublicKey = RemoveCertification(pgpPublicKey, userAttributes, certification);
                                        }
                                    }
                                }
                                finally
                                {
                                    global::System.IDisposable disposable4 = enumerator2 as global::System.IDisposable;
                                    if (disposable4 != null)
                                    {
                                        disposable4.Dispose();
                                    }
                                }
                            }
                        }
                        return(pgpPublicKey);
                    }
                    finally
                    {
                        global::System.IDisposable disposable3 = enumerator as global::System.IDisposable;
                        if (disposable3 != null)
                        {
                            disposable3.Dispose();
                        }
                    }
                }
            }
            return(pgpPublicKey);
        }
Beispiel #5
0
        private static global::System.Collections.IList SortCerts(global::System.Collections.IList certs)
        {
            if (((global::System.Collections.ICollection)certs).get_Count() < 2)
            {
                return(certs);
            }
            X509Name issuerDN = ((X509Certificate)certs.get_Item(0)).IssuerDN;
            bool     flag     = true;

            for (int i = 1; i != ((global::System.Collections.ICollection)certs).get_Count(); i++)
            {
                X509Certificate x509Certificate = (X509Certificate)certs.get_Item(i);
                if (issuerDN.Equivalent(x509Certificate.SubjectDN, inOrder: true))
                {
                    issuerDN = ((X509Certificate)certs.get_Item(i)).IssuerDN;
                    continue;
                }
                flag = false;
                break;
            }
            if (flag)
            {
                return(certs);
            }
            global::System.Collections.IList list   = Platform.CreateArrayList(((global::System.Collections.ICollection)certs).get_Count());
            global::System.Collections.IList result = Platform.CreateArrayList((global::System.Collections.ICollection)certs);
            for (int j = 0; j < ((global::System.Collections.ICollection)certs).get_Count(); j++)
            {
                X509Certificate x509Certificate2 = (X509Certificate)certs.get_Item(j);
                bool            flag2            = false;
                X509Name        subjectDN        = x509Certificate2.SubjectDN;
                {
                    global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)certs).GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            X509Certificate x509Certificate3 = (X509Certificate)enumerator.get_Current();
                            if (x509Certificate3.IssuerDN.Equivalent(subjectDN, inOrder: true))
                            {
                                flag2 = true;
                                break;
                            }
                        }
                    }
                    finally
                    {
                        global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                }
                if (!flag2)
                {
                    list.Add((object)x509Certificate2);
                    certs.RemoveAt(j);
                }
            }
            if (((global::System.Collections.ICollection)list).get_Count() > 1)
            {
                return(result);
            }
            for (int k = 0; k != ((global::System.Collections.ICollection)list).get_Count(); k++)
            {
                issuerDN = ((X509Certificate)list.get_Item(k)).IssuerDN;
                for (int l = 0; l < ((global::System.Collections.ICollection)certs).get_Count(); l++)
                {
                    X509Certificate x509Certificate4 = (X509Certificate)certs.get_Item(l);
                    if (issuerDN.Equivalent(x509Certificate4.SubjectDN, inOrder: true))
                    {
                        list.Add((object)x509Certificate4);
                        certs.RemoveAt(l);
                        break;
                    }
                }
            }
            if (((global::System.Collections.ICollection)certs).get_Count() > 0)
            {
                return(result);
            }
            return(list);
        }