private void GenNewKeys(object sender, RoutedEventArgs e) { string pubKey; string priKey; SimpleRSA.GenerateBase64RSAKeys(keysize[cbxKeys.SelectedIndex], out priKey, out pubKey); var cryptoServiceProvider = new System.Security.Cryptography.RSACryptoServiceProvider(keysize[cbxKeys.SelectedIndex]); publicKey.Text = cryptoServiceProvider.ExportPublicKey(); privateKey.Text = cryptoServiceProvider.ExportPrivateKey(); }