Example #1
0
        /// <summary>
        /// CFB decode.
        /// </summary>
        /// <param name="key">Key</param>
        /// <param name="iv">Init vector</param>
        /// <param name="message">Message</param>
        /// <param name="sBlockType">SBlock type</param>
        /// <returns>Decoded</returns>
        public static byte[] Decode(byte[] key, byte[] iv, byte[] message, SBlockTypes sBlockType)
        {
            CheckData(key, iv, message);

            using var gost = new GostManager(key, iv, message, CipherTypes.Cfb, sBlockType);
            return(gost.Decode());
        }
Example #2
0
        /// <summary>
        /// Substitution decode.
        /// </summary>
        /// <param name="key">Key</param>
        /// <param name="message">Message</param>
        /// <param name="sBlockType">SBlock type</param>
        /// <returns>Decoded</returns>
        public static byte[] Decode(byte[] key, byte[] message, SBlockTypes sBlockType)
        {
            CheckData(key, message);

            if (message.Length % 8 != 0)
            {
                throw new ArgumentException("Block must have 64 bit length");
            }

            using var gost = new GostManager(key, null, message, CipherTypes.Substitution, sBlockType);
            return(gost.Decode());
        }