Beispiel #1
0
 private static void Clear4(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj)
 {
     // ()V
     // ()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.Clear();
     }catch (global::System.Exception __ex) { @__env.ThrowExisting(__ex); }
 }
        internal void SendMessage(byte msg_type, byte[] body)
        {
            TlsUtilities.CheckUint24(body.Length);
            if (!mSending)
            {
                CheckInboundFlight();
                mSending = true;
                mOutboundFlight.Clear();
            }
            Message message = new Message(mMessageSeq++, msg_type, body);

            mOutboundFlight.Add((object)message);
            WriteMessage(message);
            UpdateHandshakeMessagesDigest(message);
        }
Beispiel #3
0
 internal void Reset()
 {
     mMissing.Clear();
     mMissing.Add((object)new Range(0, mBody.Length));
 }
Beispiel #4
0
        internal SignaturePacket(BcpgInputStream bcpgIn)
        {
            //IL_018f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0199: Expected O, but got Unknown
            //IL_025a: Unknown result type (might be due to invalid IL or missing references)
            //IL_0264: Expected O, but got Unknown
            //IL_0422: Unknown result type (might be due to invalid IL or missing references)
            //IL_0429: Expected O, but got Unknown
            //IL_0464: Unknown result type (might be due to invalid IL or missing references)
            version = ((Stream)bcpgIn).ReadByte();
            if (version == 3 || version == 2)
            {
                ((Stream)bcpgIn).ReadByte();
                signatureType = ((Stream)bcpgIn).ReadByte();
                creationTime  = (((long)((Stream)bcpgIn).ReadByte() << 24) | ((long)((Stream)bcpgIn).ReadByte() << 16) | ((long)((Stream)bcpgIn).ReadByte() << 8) | (uint)((Stream)bcpgIn).ReadByte()) * 1000;
                keyId        |= (long)((Stream)bcpgIn).ReadByte() << 56;
                keyId        |= (long)((Stream)bcpgIn).ReadByte() << 48;
                keyId        |= (long)((Stream)bcpgIn).ReadByte() << 40;
                keyId        |= (long)((Stream)bcpgIn).ReadByte() << 32;
                keyId        |= (long)((Stream)bcpgIn).ReadByte() << 24;
                keyId        |= (long)((Stream)bcpgIn).ReadByte() << 16;
                keyId        |= (long)((Stream)bcpgIn).ReadByte() << 8;
                keyId        |= (uint)((Stream)bcpgIn).ReadByte();
                keyAlgorithm  = (PublicKeyAlgorithmTag)((Stream)bcpgIn).ReadByte();
                hashAlgorithm = (HashAlgorithmTag)((Stream)bcpgIn).ReadByte();
            }
            else
            {
                if (version != 4)
                {
                    throw new global::System.Exception(string.Concat((object)"unsupported version: ", (object)version));
                }
                signatureType = ((Stream)bcpgIn).ReadByte();
                keyAlgorithm  = (PublicKeyAlgorithmTag)((Stream)bcpgIn).ReadByte();
                hashAlgorithm = (HashAlgorithmTag)((Stream)bcpgIn).ReadByte();
                int    num   = (((Stream)bcpgIn).ReadByte() << 8) | ((Stream)bcpgIn).ReadByte();
                byte[] array = new byte[num];
                bcpgIn.ReadFully(array);
                SignatureSubpacketsParser        signatureSubpacketsParser = new SignatureSubpacketsParser((Stream) new MemoryStream(array, false));
                global::System.Collections.IList list = Platform.CreateArrayList();
                SignatureSubpacket signatureSubpacket;
                while ((signatureSubpacket = signatureSubpacketsParser.ReadPacket()) != null)
                {
                    list.Add((object)signatureSubpacket);
                }
                hashedData = new SignatureSubpacket[((global::System.Collections.ICollection)list).get_Count()];
                for (int i = 0; i != hashedData.Length; i++)
                {
                    SignatureSubpacket signatureSubpacket2 = (SignatureSubpacket)list.get_Item(i);
                    if (signatureSubpacket2 is IssuerKeyId)
                    {
                        keyId = ((IssuerKeyId)signatureSubpacket2).KeyId;
                    }
                    else if (signatureSubpacket2 is SignatureCreationTime)
                    {
                        creationTime = DateTimeUtilities.DateTimeToUnixMs(((SignatureCreationTime)signatureSubpacket2).GetTime());
                    }
                    hashedData[i] = signatureSubpacket2;
                }
                int    num2   = (((Stream)bcpgIn).ReadByte() << 8) | ((Stream)bcpgIn).ReadByte();
                byte[] array2 = new byte[num2];
                bcpgIn.ReadFully(array2);
                signatureSubpacketsParser = new SignatureSubpacketsParser((Stream) new MemoryStream(array2, false));
                list.Clear();
                while ((signatureSubpacket = signatureSubpacketsParser.ReadPacket()) != null)
                {
                    list.Add((object)signatureSubpacket);
                }
                unhashedData = new SignatureSubpacket[((global::System.Collections.ICollection)list).get_Count()];
                for (int j = 0; j != unhashedData.Length; j++)
                {
                    SignatureSubpacket signatureSubpacket3 = (SignatureSubpacket)list.get_Item(j);
                    if (signatureSubpacket3 is IssuerKeyId)
                    {
                        keyId = ((IssuerKeyId)signatureSubpacket3).KeyId;
                    }
                    unhashedData[j] = signatureSubpacket3;
                }
            }
            fingerprint = new byte[2];
            bcpgIn.ReadFully(fingerprint);
            switch (keyAlgorithm)
            {
            case PublicKeyAlgorithmTag.RsaGeneral:
            case PublicKeyAlgorithmTag.RsaSign:
            {
                MPInteger mPInteger8 = new MPInteger(bcpgIn);
                signature = new MPInteger[1] {
                    mPInteger8
                };
                return;
            }

            case PublicKeyAlgorithmTag.Dsa:
            {
                MPInteger mPInteger6 = new MPInteger(bcpgIn);
                MPInteger mPInteger7 = new MPInteger(bcpgIn);
                signature = new MPInteger[2] {
                    mPInteger6, mPInteger7
                };
                return;
            }

            case PublicKeyAlgorithmTag.ElGamalEncrypt:
            case PublicKeyAlgorithmTag.ElGamalGeneral:
            {
                MPInteger mPInteger3 = new MPInteger(bcpgIn);
                MPInteger mPInteger4 = new MPInteger(bcpgIn);
                MPInteger mPInteger5 = new MPInteger(bcpgIn);
                signature = new MPInteger[3] {
                    mPInteger3, mPInteger4, mPInteger5
                };
                return;
            }

            case PublicKeyAlgorithmTag.ECDsa:
            {
                MPInteger mPInteger  = new MPInteger(bcpgIn);
                MPInteger mPInteger2 = new MPInteger(bcpgIn);
                signature = new MPInteger[2] {
                    mPInteger, mPInteger2
                };
                return;
            }
            }
            if (keyAlgorithm >= PublicKeyAlgorithmTag.Experimental_1 && keyAlgorithm <= PublicKeyAlgorithmTag.Experimental_11)
            {
                signature = null;
                MemoryStream val = new MemoryStream();
                int          num3;
                while ((num3 = ((Stream)bcpgIn).ReadByte()) >= 0)
                {
                    ((Stream)val).WriteByte((byte)num3);
                }
                signatureEncoding = val.ToArray();
                return;
            }
            throw new IOException(string.Concat((object)"unknown signature key algorithm: ", (object)keyAlgorithm));
        }
Beispiel #5
0
 public virtual void Clear()
 {
     hash.Clear();
     keys.Clear();
 }