Beispiel #1
0
        /// <summary>
        /// 解密字符串,输入BASE64编码字符串
        /// </summary>
        /// <param name="source">要解密的BASE64编码字符串</param>
        /// <param name="key">密钥字符串,长度为8或者24</param>
        /// <returns>解密的明文字符串</returns>
        public static string Decrypt(string source, string key)
        {
            source.CheckNotNullOrEmpty("source");
            key.CheckNotNullOrEmpty("key");
            byte[]    keyBytes = Encoding.UTF8.GetBytes(key);
            DesHelper des      = new DesHelper(keyBytes);

            return(des.Decrypt(source));
        }
Beispiel #2
0
        /// <summary>
        /// 解密字节数组
        /// </summary>
        /// <param name="source">要解密的字节数组</param>
        /// <param name="key">密钥字节数组,长度为8或者24</param>
        /// <returns>解密后的字节数组</returns>
        public static byte[] Decrypt(byte[] source, byte[] key)
        {
            DesHelper des = new DesHelper(key);

            return(des.Decrypt(source));
        }