This is a class for Rijndael Crypt Class
예제 #1
0
        /// <summary>
        /// Encrypt/Decypt the given cryptData with the given password
        /// </summary>
        /// <param name="algoType">Algorithm type</param>
        /// <param name="cryptData">data to crypt</param>
        /// <param name="offset">offset of cryptData for crypt</param>
        /// <param name="count">length for crypt</param>
        /// <param name="cryptPwd">password string</param>
        /// <param name="keySalt">salt string</param>
        /// <param name="cryptType">crypt type</param>
        /// <returns>encrypted/decrypted data</returns>
        /// <remarks>if keySalt is null, then default keySalt is used</remarks>
        public static byte[] GetCrypt(CryptAlgo algoType, byte[] cryptData, int offset, int count, string cryptPwd, byte[] keySalt, CryptType cryptType)
        {
            byte[] retBytes = null;
            switch (algoType)
            {
            case CryptAlgo.Aes:
                retBytes = AesCrypt.GetCrypt(cryptData, offset, count, cryptPwd, keySalt, cryptType);
                break;

            case CryptAlgo.Rijndael:
                retBytes = RijndaelCrypt.GetCrypt(cryptData, offset, count, cryptPwd, keySalt, cryptType);
                break;
            }
            return(retBytes);
        }
예제 #2
0
        /// <summary>
        /// Encrypt/Decypt the given cryptData with the given password
        /// </summary>
        /// <param name="cryptData">data to crypt</param>
        /// <param name="cryptPwd">password string</param>
        /// <param name="cryptType">crypt type</param>
        /// <returns>encrypted/decrypted data</returns>
        public static byte[] GetCrypt(CryptAlgo algoType, byte[] cryptData, string cryptPwd, CryptType cryptType)
        {
            byte[] retBytes = null;
            switch (algoType)
            {
            case CryptAlgo.Aes:
                retBytes = AesCrypt.GetCrypt(cryptData, cryptPwd, null, cryptType);
                break;

            case CryptAlgo.Rijndael:
                retBytes = RijndaelCrypt.GetCrypt(cryptData, cryptPwd, null, cryptType);
                break;
            }
            return(retBytes);
        }
예제 #3
0
        /// <summary>
        /// Encrypt/Decypt the given cryptData string with the given password
        /// </summary>
        /// <param name="cryptData">string data to encrypt</param>
        /// <param name="cryptPwd">password string</param>
        /// <param name="cryptType">crypt type</param>
        /// <returns>encrypted/decrypted data</returns>
        public static string GetCrypt(CryptAlgo algoType, string cryptData, string cryptPwd, CryptType cryptType)
        {
            string retString = null;

            switch (algoType)
            {
            case CryptAlgo.Aes:
                retString = AesCrypt.GetCrypt(cryptData, cryptPwd, null, cryptType);
                break;

            case CryptAlgo.Rijndael:
                retString = RijndaelCrypt.GetCrypt(cryptData, cryptPwd, null, cryptType);
                break;
            }
            return(retString);
        }