Esempio n. 1
0
        /// <summary>
        /// 用私钥解密经加密后的Base64字符串
        /// </summary>
        /// <param name="base64Source"></param>
        /// <param name="privateKey"></param>
        /// <returns></returns>
        public static string Decrypt(string base64Source, string privateKey)
        {
            var bs  = Convert.FromBase64String(base64Source);
            var rsa = new Rsa(privateKey);
            var rst = rsa.Decrypt(bs);

            return(Encoding.UTF8.GetString(rst));
        }
Esempio n. 2
0
 /// <summary>
 /// 解密出原始Key
 /// </summary>
 /// <param name="token"></param>
 /// <returns></returns>
 public static byte[] DeRsaKey(byte[] token)
 {
     var rsa = new Rsa(PrivateKey);
     return rsa.Decrypt(token);
 }
Esempio n. 3
0
        /// <summary>
        /// 解密出原始Key
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        public static byte[] DeRsaKey(byte[] token)
        {
            var rsa = new Rsa(PrivateKey);

            return(rsa.Decrypt(token));
        }