Exemplo n.º 1
0
    // Token: 0x0600000E RID: 14 RVA: 0x00004A34 File Offset: 0x00002C34
    public static void uploadserialized(Stream stream, object message)
    {
        BinaryFormatter binaryFormatter = new BinaryFormatter();

        binaryFormatter.AssemblyFormat = FormatterAssemblyStyle.Simple;
        binaryFormatter.TypeFormat     = FormatterTypeStyle.TypesAlways;
        binaryFormatter.FilterLevel    = TypeFilterLevel.Full;
        TcpClient client = Server.Client;

        lock (client)
        {
            if (Server.encryptedconnection & message is string)
            {
                message = EncryptionFunctions.PublicEncrypt(Conversions.ToString(message), "chizzy25@", Server.encryptionindex);
            }
            object objectValue = RuntimeHelpers.GetObjectValue(message);
            using (MemoryStream memoryStream = new MemoryStream())
            {
                binaryFormatter.Serialize(memoryStream, RuntimeHelpers.GetObjectValue(objectValue));
                ulong position = (ulong)memoryStream.Position;
                Server.Client.GetStream().Write(BitConverter.GetBytes(position), 0, 8);
                byte[] buffer = memoryStream.GetBuffer();
                Server.Client.GetStream().Write(buffer, 0, (int)position);
                memoryStream.Close();
                memoryStream.Dispose();
            }
        }
    }
    // Token: 0x0600004B RID: 75 RVA: 0x000067CC File Offset: 0x000049CC
    public static string PublicDecrypt(string text, string password, int dectype)
    {
        string result = string.Empty;

        switch (dectype)
        {
        case 0:
            result = EncryptionFunctions.XOR_Universal(text, password);
            break;

        case 1:
            result = EncryptionFunctions.AES_DecryptCBC(text, password);
            break;

        case 2:
            result = EncryptionFunctions.AES_DecryptECB(text, password);
            break;
        }
        return(result);
    }