# Decryption in ruby

**URL:** <https://www.ruby-forum.com/t/decryption-in-ruby/159814>\
**Category:** Ruby\
**Created:** [February 9, 2009, 6:18am UTC](https://www.ruby-forum.com/t/decryption-in-ruby/159814 "2009-02-09T06:18:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vetrivel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/dc4da7/32.png) [@vetrivel](https://www.ruby-forum.com/u/vetrivel)\
**Post date:** [February 9, 2009, 6:18am UTC](https://www.ruby-forum.com/t/decryption-in-ruby/159814/1 "2009-02-09T06:18:07Z")

</div>

I have a decryption doutes in ruby.

A person encrypts the data in c# language using  
RSACryptoServiceProvider class.  
Example RSA decryption in c# Language

Deryption Algorithm in C#

public static string DecryptData(string data2Decrypt)  
{  
AssignParameter();  
byte[] getpassword = Convert.FromBase64String(data2Decrypt);  
StreamReader reader = new StreamReader(@“C:\Keys\privatekey.xml”);  
string publicPrivateKeyXML = reader.ReadToEnd();  
rsa.FromXmlString(publicPrivateKeyXML);  
reader.Close();  
//read ciphertext, decrypt it to plaintext  
byte[] plain = rsa.Decrypt(getpassword, false);  
return System.Text.Encoding.UTF8.GetString(plain);  
}

How to do c# Decryption in ruby.
