/// <summary> /// 将密钥转换为字符串 /// </summary> /// <param name="key"></param> /// <returns></returns> static public string KeyToString(RSAParameters key) { InnerRSAParameters inner; inner.D = key.D; inner.DP = key.DP; inner.DQ = key.DQ; inner.Exponent = key.Exponent; inner.InverseQ = key.InverseQ; inner.Modulus = key.Modulus; inner.P = key.P; inner.Q = key.Q; Stream s = Hubble.Framework.Serialization.XmlSerialization.Serialize(inner); byte[] buf = new byte[s.Length]; s.Position = 0; s.Read(buf, 0, (int)s.Length); return(EncryptString.GetString(buf)); }
public static String Decrypt(string key, String text) { return(Decrypt(EncryptString.GetBytes(key), EncryptString.GetBytes(text))); }
public static String Decrypt(byte[] key, String text) { return(Decrypt(key, EncryptString.GetBytes(text))); }