日期:2014-05-18 浏览次数:20554 次
//加密 public static string Encode(string key) { dsa.FromXmlString(PRIVATE_KEY); System.Security.Cryptography.DSASignatureFormatter f = new System.Security.Cryptography.DSASignatureFormatter(dsa); f.SetHashAlgorithm("SHA1"); Byte[] source = System.Text.ASCIIEncoding.ASCII.GetBytes(key); System.Security.Cryptography.SHA1Managed sha = new System.Security.Cryptography.SHA1Managed(); Byte[] result = sha.ComputeHash(source); Byte[] regkey = f.CreateSignature(result); return Convert.ToBase64String(regkey); }