/// <summary> /// Create a public key block from a private key. /// </summary> /// <param name="privateKey">The <see cref="DSA" /> PrivateKey.</param> /// <returns>The <see cref="DSACryptoServiceProvider" /> PublicKey.</returns> public static DSACryptoServiceProvider make_pubkey(DSA privateKey) { var publicKey = new DSACryptoServiceProvider(1024); publicKey.ImportParameters(privateKey.ExportParameters(false)); if (!publicKey.PublicOnly) { publicKey.Dispose(); throw new Exception("PublicKey contains PrivateKey information, cancelling."); } return publicKey; }