new System.Security.Cryptography.RSACryptoServiceProvider (1024).ToXmlString (true)
if needed, press F4 to add reference, and add reference to System.Security.dll
In Powershell
$rsa = New-Object System.Security.Cryptography.RSACryptoServiceProvider (1024);
public key
$rsa.ToXmlString($false)
private key
$rsa.ToXmlString($true)