Пример #1
0
        public static void Des_Test(string src)
        {
            var key = "88899900";
            var enc = EncryptionUtil.EncryptDES(src, key);

            Debug.WriteLine("src:{0},key:{1},src_enc:{2},src_dec:{3}", src, key, enc, EncryptionUtil.DecryptDES(enc, key));
        }
Пример #2
0
 /// <summary>
 /// DES加密
 /// <para>将一个对象用DES CBC的方式根据privateKey和publicKey进行加密</para>
 /// <para>公钥和私钥只能是可以通过Encoding.GetBytes转换的字符串,否则密钥验证会失效</para>
 /// </summary>
 /// <param name="content">要加密的对象</param>
 /// <param name="privateKey">私钥</param>
 /// <param name="publicKey">公钥</param>
 /// <returns></returns>
 public static string EncryptDES(this object content, string privateKey, string publicKey)
 {
     return(EncryptionUtil.EncryptDES(content, privateKey, publicKey));
 }