Exemple #1
0
 public string decrypt(string encrypted)
 {
     try {
         return(Encoding.Unicode.GetString(DeobUtils.des3Decrypt(Convert.FromBase64String(encrypted), key, iv)));
     }
     catch (FormatException) {
         return("");
     }
 }
Exemple #2
0
        public void initialize()
        {
            if (decrypterType == null)
            {
                return;
            }

            decryptedData = new byte[encryptedDataField.InitialValue.Length];
            Array.Copy(encryptedDataField.InitialValue, 0, decryptedData, 0, decryptedData.Length);

            if ((stringDataFlags & StringDataFlags.Encrypted1) != 0)
            {
                for (int i = 0; i < decryptedData.Length; i++)
                {
                    decryptedData[i] ^= (byte)i;
                }
            }

            if ((stringDataFlags & StringDataFlags.Encrypted2) != 0)
            {
                var k    = module.Assembly.PublicKey.Data;
                int mask = (byte)(~k.Length);
                for (int i = 0; i < decryptedData.Length; i++)
                {
                    decryptedData[i] ^= k[i & mask];
                }
            }

            if ((stringDataFlags & StringDataFlags.Encrypted3DES) != 0)
            {
                decryptedData = DeobUtils.des3Decrypt(decryptedData, key, iv);
            }

            if ((stringDataFlags & StringDataFlags.Compressed) != 0)
            {
                decryptedData = QclzDecompressor.decompress(decryptedData);
            }
        }