Exemplo n.º 1
0
        /// <summary>
        /// 生成公钥、私钥
        /// </summary>
        /// <param name="publicKey">公钥(Xml格式)</param>
        /// <param name="privateKey">私钥(Xml格式)</param>
        /// <param name="keySize">要生成的KeySize,支持的MinSize:512 MaxSize:1024 SkipSize:64</param>
        public static void Create(out string publicKey, out string privateKey, int keySize = 1024)
        {
            DSACryptoServiceProvider provider = new DSACryptoServiceProvider(keySize);

            KeyGenerator.CreateAsymmetricAlgorithmKey(out publicKey, out privateKey, provider);
        }
 /// <summary>
 /// 按默认规则生成公钥、私钥
 /// </summary>
 /// <param name="publicKey">公钥(Xml格式)</param>
 /// <param name="privateKey">私钥(Xml格式)</param>
 public static void Create(out string publicKey, out string privateKey)
 {
     KeyGenerator.CreateAsymmetricAlgorithmKey <T>(out publicKey, out privateKey);
 }