Beispiel #1
0
        /// <summary>
        /// Método descriptografar
        /// </summary>
        /// <param name="Str"></param>
        /// <returns></returns>
        public static string Decrypt(string Str)
        {
            int discarded = 0;

            byte[] key   = EncrypAndDecryptSecurity.GetBytes("AA AD 8B 4C 00 E1 3F 53 B8 E7 16 BC B5 F4 D1 B9", out discarded);
            byte[] vetor = EncrypAndDecryptSecurity.GetBytes("FA 0E 3C 9B 4F A2 C7 AA 37 0F CA 9B 5A 91 64 08", out discarded);

            Str = Encoding.UTF8.GetString(_EncrypAndDecryptSecurity.Decrypt(EncrypAndDecryptSecurity.GetBytes(Str, out discarded), key, vetor)).Trim();

            return(Str);
        }
Beispiel #2
0
        /// <summary>
        /// Método criptografar
        /// </summary>
        /// <param name="Str"></param>
        /// <returns></returns>
        public static string Encrypt(string Str)
        {
            int discarded = 0;

            byte[] key   = EncrypAndDecryptSecurity.GetBytes("AA AD 8B 4C 00 E1 3F 53 B8 E7 16 BC B5 F4 D1 B9", out discarded);
            byte[] vetor = EncrypAndDecryptSecurity.GetBytes("FA 0E 3C 9B 4F A2 C7 AA 37 0F CA 9B 5A 91 64 08", out discarded);

            while ((Str.Length % 16) != 0)
            {
                Str = Str + " ";
            }

            Str = EncrypAndDecryptSecurity.ToString(_EncrypAndDecryptSecurity.Encrypt(Encoding.UTF8.GetBytes(Str), key, vetor));

            return(Str);
        }