Ejemplo n.º 1
0
        public static ulong DecryptUInt64(
            this ICipher cipher,
            byte[] encrypted)
        {
            if (cipher == null)
            {
                throw new ArgumentNullException(nameof(cipher));
            }
            if (encrypted == null)
            {
                throw new ArgumentNullException(nameof(encrypted));
            }

            var decrypted = cipher.Decrypt(encrypted);

            if (decrypted.Length < 8)
            {
                throw new ArgumentException(Resources.InvalidEncryptedValue);
            }

            return(FromByteArray.ToUInt64(decrypted));
        }