<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: RSA using BouncyCastle</title>
	<atom:link href="http://ox.no/posts/rsa-using-bouncycastle/feed" rel="self" type="application/rss+xml" />
	<link>http://ox.no/posts/rsa-using-bouncycastle</link>
	<description>Håvard Stranden&#039;s website</description>
	<lastBuildDate>Thu, 27 Oct 2011 19:33:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Venu</title>
		<link>http://ox.no/posts/rsa-using-bouncycastle/comment-page-1#comment-1581</link>
		<dc:creator>Venu</dc:creator>
		<pubDate>Tue, 31 May 2011 16:05:17 +0000</pubDate>
		<guid isPermaLink="false">http://ox.no/?p=80#comment-1581</guid>
		<description>&lt;p&gt;Hi Matt&lt;/p&gt;

&lt;p&gt;thanks a lot for the code 
i tried your code but i am getting error &quot;attempt to process message to long for cipher&quot; while decrypting the encrypted file.&lt;/p&gt;

&lt;p&gt;Please can you suggest me where i might have gone wrong.&lt;/p&gt;

&lt;p&gt;Thanks for helping me&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Matt</p>

<p>thanks a lot for the code 
i tried your code but i am getting error &#8220;attempt to process message to long for cipher&#8221; while decrypting the encrypted file.</p>

<p>Please can you suggest me where i might have gone wrong.</p>

<p>Thanks for helping me</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Olson</title>
		<link>http://ox.no/posts/rsa-using-bouncycastle/comment-page-1#comment-1570</link>
		<dc:creator>Matt Olson</dc:creator>
		<pubDate>Sat, 28 May 2011 21:30:39 +0000</pubDate>
		<guid isPermaLink="false">http://ox.no/?p=80#comment-1570</guid>
		<description>&lt;p&gt;Here is a more verbose example wtih padding and the encryption / decryption routines don&#039;t have bugs in them that cause long data to fail.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;        private void btnGenerateKeys_Click(object sender, EventArgs e)
        {
            //ECDSASample(384);
            AsymmetricCipherKeyPair keys = GenerateRSAKeys(1024);&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;        /&lt;em&gt;Option 1 to write RSA Private key, doesn&#039;t work with public however&lt;/em&gt;/
        PrivateKeyInfo privateKeyInfo = PrivateKeyInfoFactory.CreatePrivateKeyInfo(keys.Private);
        byte[] serializedPrivateKey = privateKeyInfo.ToAsn1Object().GetDerEncoded();
        System.IO.File.WriteAllBytes(&quot;C:&#092;RSAPrivate.key&quot;,serializedPrivateKey);&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    /*Option 2 to write RSA Private Key, works same way with public*/
    StringBuilder sb = new StringBuilder();
    PemWriter pemwrit = new PemWriter(new StringWriter(sb));
    //char[] password = &quot;test123&quot;.ToCharArray();
    pemwrit.WriteObject(keys.Private);
    pemwrit.Writer.Flush();

    System.IO.File.WriteAllText(&quot;C:\\RSAPrivate.Key&quot;,sb.ToString());

    sb = new StringBuilder();
    pemwrit = new PemWriter(new StringWriter(sb));
    pemwrit.WriteObject(keys.Public);
    pemwrit.Writer.Flush();

    System.IO.File.WriteAllText(&quot;C:\\RSAPublic.Key&quot;, sb.ToString());

    /*Example to read it back*/
    StringBuilder sbr = new StringBuilder();
    PemReader reader = new PemReader(new StringReader(pemwrit.Writer.ToString()));
    AsymmetricKeyParameter pubKey = (AsymmetricKeyParameter)reader.ReadObject();
    //RsaPublicKeyStructure key = new RsaPublicKeyStructure(reader.ReadObject();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;public byte[] RSAEncryptV3(byte[] data, AsymmetricKeyParameter key)
        {
            SecureRandom rand = new SecureRandom();
            IBufferedCipher cipher = CipherUtilities.GetCipher(&quot;RSA/NONE/OAEPWithSHA1AndMGF1Padding&quot;);&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;        cipher.Init(true, new ParametersWithRandom(key, rand));&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    byte[] cipherTextBlock = null; 
    int outputsize = cipher.GetOutputSize(data.Length); //Array size of ciphered data (encrypted data)
    int blockSize = cipher.GetBlockSize();  //Amount of data we can process at one time (-2 -2*hlen)
    List&lt;byte&gt; output = new List&lt;byte&gt;();
    int outputLen = 0;
    byte[] dataToProcess = null;
    for (int chunkPosition = 0; chunkPosition &lt; data.Length; chunkPosition += blockSize)
    {
        dataToProcess = new byte[blockSize];
        int chunkSize = (data.Length - chunkPosition) &lt; blockSize ? (data.Length - chunkPosition) : blockSize; //Math.Min(blockSize, data.Length - (chunkPosition * blockSize));
        Buffer.BlockCopy(data, chunkPosition, dataToProcess, 0, chunkSize);

        cipherTextBlock = new byte[outputsize];

        outputLen = cipher.ProcessBytes(dataToProcess, 0, chunkSize, cipherTextBlock, 0);
        cipher.DoFinal(cipherTextBlock, outputLen);
        //output.AddRange(e.ProcessBytes(data, chunkPosition,
        //  chunkSize));
        output.AddRange(cipherTextBlock);
    }

    return output.ToArray();
}

public byte[] RSADecryptV3(byte[] data, AsymmetricKeyParameter key)
{

    SecureRandom rand = new SecureRandom();
    IBufferedCipher cipher = CipherUtilities.GetCipher(&quot;RSA/NONE/OAEPWithSHA1AndMGF1Padding&quot;);

    cipher.Init(false, new ParametersWithRandom(key, rand));

    byte[] cipherTextBlock = null;
    int outputsize = cipher.GetOutputSize(data.Length); //Array size of ciphered data (encrypted data)
    int blockSize = cipher.GetBlockSize();  //Amount of data we can process at one time (-2 -2*hlen)
    List&lt;byte&gt; output = new List&lt;byte&gt;();
    int outputLen = 0;
    byte[] dataToProcess = null;

    for (int chunkPosition = 0; chunkPosition &lt; data.Length; chunkPosition += blockSize)
    {
        dataToProcess = new byte[blockSize];
        int chunkSize = (data.Length - chunkPosition) &lt; blockSize ? (data.Length - chunkPosition) : blockSize; //Math.Min(blockSize, data.Length - (chunkPosition * blockSize));
        Buffer.BlockCopy(data, chunkPosition, dataToProcess, 0, chunkSize);

        cipherTextBlock = new byte[outputsize];

        outputLen = cipher.ProcessBytes(dataToProcess, 0, chunkSize, cipherTextBlock, 0);
        cipher.DoFinal(cipherTextBlock, outputLen);
        //output.AddRange(e.ProcessBytes(data, chunkPosition,
        //  chunkSize));
        output.AddRange(cipherTextBlock);
    }

    return output.ToArray();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;&lt;/code&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Here is a more verbose example wtih padding and the encryption / decryption routines don&#8217;t have bugs in them that cause long data to fail.</p>

<p><code>        private void btnGenerateKeys_Click(object sender, EventArgs e)
        {
            //ECDSASample(384);
            AsymmetricCipherKeyPair keys = GenerateRSAKeys(1024);</code></p>

<p><pre><code>        /<em>Option 1 to write RSA Private key, doesn't work with public however</em>/
        PrivateKeyInfo privateKeyInfo = PrivateKeyInfoFactory.CreatePrivateKeyInfo(keys.Private);
        byte[] serializedPrivateKey = privateKeyInfo.ToAsn1Object().GetDerEncoded();
        System.IO.File.WriteAllBytes("C:&#92;RSAPrivate.key",serializedPrivateKey);</code></pre></p>

<pre><code>    /*Option 2 to write RSA Private Key, works same way with public*/
    StringBuilder sb = new StringBuilder();
    PemWriter pemwrit = new PemWriter(new StringWriter(sb));
    //char[] password = "test123".ToCharArray();
    pemwrit.WriteObject(keys.Private);
    pemwrit.Writer.Flush();

    System.IO.File.WriteAllText("C:\\RSAPrivate.Key",sb.ToString());

    sb = new StringBuilder();
    pemwrit = new PemWriter(new StringWriter(sb));
    pemwrit.WriteObject(keys.Public);
    pemwrit.Writer.Flush();

    System.IO.File.WriteAllText("C:\\RSAPublic.Key", sb.ToString());

    /*Example to read it back*/
    StringBuilder sbr = new StringBuilder();
    PemReader reader = new PemReader(new StringReader(pemwrit.Writer.ToString()));
    AsymmetricKeyParameter pubKey = (AsymmetricKeyParameter)reader.ReadObject();
    //RsaPublicKeyStructure key = new RsaPublicKeyStructure(reader.ReadObject();
}
</code></pre>

<p></p>

<p>public byte[] RSAEncryptV3(byte[] data, AsymmetricKeyParameter key)
        {
            SecureRandom rand = new SecureRandom();
            IBufferedCipher cipher = CipherUtilities.GetCipher("RSA/NONE/OAEPWithSHA1AndMGF1Padding");</p>

<p><pre><code>        cipher.Init(true, new ParametersWithRandom(key, rand));</code></pre></p>

<pre><code>    byte[] cipherTextBlock = null; 
    int outputsize = cipher.GetOutputSize(data.Length); //Array size of ciphered data (encrypted data)
    int blockSize = cipher.GetBlockSize();  //Amount of data we can process at one time (-2 -2*hlen)
    List&amp;lt;byte&amp;gt; output = new List&amp;lt;byte&amp;gt;();
    int outputLen = 0;
    byte[] dataToProcess = null;
    for (int chunkPosition = 0; chunkPosition &amp;lt; data.Length; chunkPosition += blockSize)
    {
        dataToProcess = new byte[blockSize];
        int chunkSize = (data.Length - chunkPosition) &amp;lt; blockSize ? (data.Length - chunkPosition) : blockSize; //Math.Min(blockSize, data.Length - (chunkPosition * blockSize));
        Buffer.BlockCopy(data, chunkPosition, dataToProcess, 0, chunkSize);

        cipherTextBlock = new byte[outputsize];

        outputLen = cipher.ProcessBytes(dataToProcess, 0, chunkSize, cipherTextBlock, 0);
        cipher.DoFinal(cipherTextBlock, outputLen);
        //output.AddRange(e.ProcessBytes(data, chunkPosition,
        //  chunkSize));
        output.AddRange(cipherTextBlock);
    }

    return output.ToArray();
}

public byte[] RSADecryptV3(byte[] data, AsymmetricKeyParameter key)
{

    SecureRandom rand = new SecureRandom();
    IBufferedCipher cipher = CipherUtilities.GetCipher("RSA/NONE/OAEPWithSHA1AndMGF1Padding");

    cipher.Init(false, new ParametersWithRandom(key, rand));

    byte[] cipherTextBlock = null;
    int outputsize = cipher.GetOutputSize(data.Length); //Array size of ciphered data (encrypted data)
    int blockSize = cipher.GetBlockSize();  //Amount of data we can process at one time (-2 -2*hlen)
    List&amp;lt;byte&amp;gt; output = new List&amp;lt;byte&amp;gt;();
    int outputLen = 0;
    byte[] dataToProcess = null;

    for (int chunkPosition = 0; chunkPosition &amp;lt; data.Length; chunkPosition += blockSize)
    {
        dataToProcess = new byte[blockSize];
        int chunkSize = (data.Length - chunkPosition) &amp;lt; blockSize ? (data.Length - chunkPosition) : blockSize; //Math.Min(blockSize, data.Length - (chunkPosition * blockSize));
        Buffer.BlockCopy(data, chunkPosition, dataToProcess, 0, chunkSize);

        cipherTextBlock = new byte[outputsize];

        outputLen = cipher.ProcessBytes(dataToProcess, 0, chunkSize, cipherTextBlock, 0);
        cipher.DoFinal(cipherTextBlock, outputLen);
        //output.AddRange(e.ProcessBytes(data, chunkPosition,
        //  chunkSize));
        output.AddRange(cipherTextBlock);
    }

    return output.ToArray();
}
</code></pre>

<p></p>

<p></p>]]></content:encoded>
	</item>
	<item>
		<title>By: praveen</title>
		<link>http://ox.no/posts/rsa-using-bouncycastle/comment-page-1#comment-1546</link>
		<dc:creator>praveen</dc:creator>
		<pubDate>Tue, 24 May 2011 20:45:54 +0000</pubDate>
		<guid isPermaLink="false">http://ox.no/?p=80#comment-1546</guid>
		<description>&lt;p&gt;Hi all, thanks for all the help you have given here on this post..this really helped me to understand the Bouncy API. i am stucked with a problem and i want to post here to take your suggestions..
my requirement is to store the public key and private key in the database (Sql server) as a string (nvarchar(max)) and retrieve those keys while encrypting or decrypting. can you please help me to convert a string to cipher key parameter.  i want to use any of the asymetric engines for this purpose.
the code i have written for this is :
  BufferedBlockCipher bufferedCipher = new BufferedBlockCipher(desedeEngine);
            System.Text.UTF8Encoding UTFEncode = new UTF8Encoding();
            byte[] keyByte = UTFEncode.GetBytes(PublicKey);&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code&gt;        // Create the KeyParameter for the DES3 key generated. 
        KeyParameter keyparam = ParameterUtilities.CreateKeyParameter(&quot;DES&quot;, keyByte);
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;iam able to execute the projec but if if i verify the decypted file its actually not decrypted. can you please suggest.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi all, thanks for all the help you have given here on this post..this really helped me to understand the Bouncy API. i am stucked with a problem and i want to post here to take your suggestions..
my requirement is to store the public key and private key in the database (Sql server) as a string (nvarchar(max)) and retrieve those keys while encrypting or decrypting. can you please help me to convert a string to cipher key parameter.  i want to use any of the asymetric engines for this purpose.
the code i have written for this is :
  BufferedBlockCipher bufferedCipher = new BufferedBlockCipher(desedeEngine);
            System.Text.UTF8Encoding UTFEncode = new UTF8Encoding();
            byte[] keyByte = UTFEncode.GetBytes(PublicKey);</p>

<p><pre><code>        // Create the KeyParameter for the DES3 key generated. 
        KeyParameter keyparam = ParameterUtilities.CreateKeyParameter("DES", keyByte);
</code></pre></p>

<p>iam able to execute the projec but if if i verify the decypted file its actually not decrypted. can you please suggest.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Håvard</title>
		<link>http://ox.no/posts/rsa-using-bouncycastle/comment-page-1#comment-1263</link>
		<dc:creator>Håvard</dc:creator>
		<pubDate>Mon, 14 Feb 2011 22:58:30 +0000</pubDate>
		<guid isPermaLink="false">http://ox.no/?p=80#comment-1263</guid>
		<description>&lt;p&gt;@Hashim The article is correct. We&#039;re not discussing correctness. What you are discussing is cryptographical strength.&lt;/p&gt;

&lt;p&gt;Block modes are actually only one of the weaknesses it has from a cryptanalytic perspective - others include lack of blinding, making it susceptible to timing attacks, and other shortcomings which are covered in the Wikipedia article cited by you. Also, more recent research suggest that even the sign/encrypt approach has flaws (read Don Davis&#039; paper &quot;Defective Sign &amp; Encrypt in SMIME, PKCS#7, MOSS, PEM, PGP and XML&quot; from 2001 for an in-depth analysis). Even if there are weaknesses to all the various approaches, they are strong for certain applications. The key is knowing what to apply under which circumstances. &lt;/p&gt;

&lt;p&gt;This topic is far beyond the scope of the article. Scaring people with statements is just as bad as ignorance. What needs to be done is to raise awareness, and crying &quot;wolf wolf&quot; never helped that. I think we agree on that, and I agree that the reader could benefit from a notice. It has been added.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Hashim The article is correct. We&#8217;re not discussing correctness. What you are discussing is cryptographical strength.</p>

<p>Block modes are actually only one of the weaknesses it has from a cryptanalytic perspective &#8211; others include lack of blinding, making it susceptible to timing attacks, and other shortcomings which are covered in the Wikipedia article cited by you. Also, more recent research suggest that even the sign/encrypt approach has flaws (read Don Davis&#8217; paper &#8220;Defective Sign &amp; Encrypt in SMIME, PKCS#7, MOSS, PEM, PGP and XML&#8221; from 2001 for an in-depth analysis). Even if there are weaknesses to all the various approaches, they are strong for certain applications. The key is knowing what to apply under which circumstances. </p>

<p>This topic is far beyond the scope of the article. Scaring people with statements is just as bad as ignorance. What needs to be done is to raise awareness, and crying &#8220;wolf wolf&#8221; never helped that. I think we agree on that, and I agree that the reader could benefit from a notice. It has been added.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Hashim Malin</title>
		<link>http://ox.no/posts/rsa-using-bouncycastle/comment-page-1#comment-1262</link>
		<dc:creator>Hashim Malin</dc:creator>
		<pubDate>Mon, 14 Feb 2011 21:45:47 +0000</pubDate>
		<guid isPermaLink="false">http://ox.no/?p=80#comment-1262</guid>
		<description>&lt;p&gt;...your article says &quot;processes a data set of an arbitrary size&quot;.  This is wrong.  The fact that you&#039;ve wrapped the RSA code in a loop at all is wrong.  If you have enough data that you feel the need to make a loop like that, you -- by definition -- have enough data that you need to use one of the cryptographically secure schemes that have been developed to allow block ciphers to do this.&lt;/p&gt;

&lt;p&gt;Wikipedia is a good start: https://secure.wikimedia.org/wikipedia/en/wiki/Block_cipher_modes_of_operation&lt;/p&gt;

&lt;p&gt;What you&#039;re doing in your post is ECB mode.  ECB mode has long been known by the security community to not provide serious message confidentiality.  At the very least your original post should mention this and provide people a link to an elementary discussion of block cipher modes.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8230;your article says &#8220;processes a data set of an arbitrary size&#8221;.  This is wrong.  The fact that you&#8217;ve wrapped the RSA code in a loop at all is wrong.  If you have enough data that you feel the need to make a loop like that, you &#8212; by definition &#8212; have enough data that you need to use one of the cryptographically secure schemes that have been developed to allow block ciphers to do this.</p>

<p>Wikipedia is a good start: <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Block_cipher_modes_of_operation" rel="nofollow">https://secure.wikimedia.org/wikipedia/en/wiki/Block_cipher_modes_of_operation</a></p>

<p>What you&#8217;re doing in your post is ECB mode.  ECB mode has long been known by the security community to not provide serious message confidentiality.  At the very least your original post should mention this and provide people a link to an elementary discussion of block cipher modes.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Håvard</title>
		<link>http://ox.no/posts/rsa-using-bouncycastle/comment-page-1#comment-1235</link>
		<dc:creator>Håvard</dc:creator>
		<pubDate>Sat, 29 Jan 2011 22:44:34 +0000</pubDate>
		<guid isPermaLink="false">http://ox.no/?p=80#comment-1235</guid>
		<description>&lt;p&gt;@Hashim The code itself is most definitely not &quot;dangerously wrong&quot;, but it can of course be used in scenarios where it would be unsafe.&lt;/p&gt;

&lt;p&gt;The article neither suggests that it is a good idea to encrypt large data using the scheme it implements, nor discusses the safety of this particular RSA scheme versus other schemes. In fact, it does not concern itself with security issues at all. This is deliberate because it is a &lt;em&gt;different matter&lt;/em&gt;, way beyond the scope of the article. The implementation is a perfectly valid use of RSA, which for small data sets (size depends on key size and is another matter beyond the scope of the article) is safe and sound.&lt;/p&gt;

&lt;p&gt;Saying that the code is unsafe is like saying that code which allows using RSA with a small key size is unsafe. It obviously is unsafe in the general case, but that doesn&#039;t mean it&#039;s wrong.&lt;/p&gt;

&lt;p&gt;Moral: You must never uncritically copy/paste code off the internet without being sure it is valid, sound, safe, and correct for your usage scenario.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Hashim The code itself is most definitely not &#8220;dangerously wrong&#8221;, but it can of course be used in scenarios where it would be unsafe.</p>

<p>The article neither suggests that it is a good idea to encrypt large data using the scheme it implements, nor discusses the safety of this particular RSA scheme versus other schemes. In fact, it does not concern itself with security issues at all. This is deliberate because it is a <em>different matter</em>, way beyond the scope of the article. The implementation is a perfectly valid use of RSA, which for small data sets (size depends on key size and is another matter beyond the scope of the article) is safe and sound.</p>

<p>Saying that the code is unsafe is like saying that code which allows using RSA with a small key size is unsafe. It obviously is unsafe in the general case, but that doesn&#8217;t mean it&#8217;s wrong.</p>

<p>Moral: You must never uncritically copy/paste code off the internet without being sure it is valid, sound, safe, and correct for your usage scenario.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Hashim Malin</title>
		<link>http://ox.no/posts/rsa-using-bouncycastle/comment-page-1#comment-1234</link>
		<dc:creator>Hashim Malin</dc:creator>
		<pubDate>Sat, 29 Jan 2011 04:33:46 +0000</pubDate>
		<guid isPermaLink="false">http://ox.no/?p=80#comment-1234</guid>
		<description>&lt;p&gt;This code is dangerously wrong.  There is a REASON that the API for RSA limits the size of block you can encrypt directly to a function of the key size, and when you use this naive approach to apply the same key to many chunks of data, you leak enough information to allow the factoring of your private keys by adversaries.  I repeat: if you use this code as given above, you are doing absolutely nothing but giving yourself a false sense of security.&lt;/p&gt;

&lt;p&gt;To encrypt large volumes of data using RSA, it is CRITICAL to use a padding scheme -- a system called RSA-OAEP is one example.  Well designed padding schemes used in conjunction with RSA prevent dictionary attacks, chosen plaintext attacks via ciphertext mutability based on the multiplicative homomorphism feature of RSA, and defend against recovery of cleartext which is otherwise possible when sending the same message to multiple public keys.&lt;/p&gt;

&lt;p&gt;Honestly, just a quick perusal of wikipedia&#039;s article on RSA should be enough to convince anyone that the code offered in this article is deeply flawed and fundamentally insecure.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This code is dangerously wrong.  There is a REASON that the API for RSA limits the size of block you can encrypt directly to a function of the key size, and when you use this naive approach to apply the same key to many chunks of data, you leak enough information to allow the factoring of your private keys by adversaries.  I repeat: if you use this code as given above, you are doing absolutely nothing but giving yourself a false sense of security.</p>

<p>To encrypt large volumes of data using RSA, it is CRITICAL to use a padding scheme &#8212; a system called RSA-OAEP is one example.  Well designed padding schemes used in conjunction with RSA prevent dictionary attacks, chosen plaintext attacks via ciphertext mutability based on the multiplicative homomorphism feature of RSA, and defend against recovery of cleartext which is otherwise possible when sending the same message to multiple public keys.</p>

<p>Honestly, just a quick perusal of wikipedia&#8217;s article on RSA should be enough to convince anyone that the code offered in this article is deeply flawed and fundamentally insecure.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Hector Huerta</title>
		<link>http://ox.no/posts/rsa-using-bouncycastle/comment-page-1#comment-874</link>
		<dc:creator>Hector Huerta</dc:creator>
		<pubDate>Mon, 13 Sep 2010 09:09:13 +0000</pubDate>
		<guid isPermaLink="false">http://ox.no/?p=80#comment-874</guid>
		<description>&lt;p&gt;Hi! I am using the new version of BouncyCastle for C# , and now it&#039;s working, but I can not load my previously generated PrivateKey could you give us and example of loading one with the RSAKeyParameters instance?&lt;/p&gt;

&lt;p&gt;Thank you very much&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi! I am using the new version of BouncyCastle for C# , and now it&#8217;s working, but I can not load my previously generated PrivateKey could you give us and example of loading one with the RSAKeyParameters instance?</p>

<p>Thank you very much</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Glen</title>
		<link>http://ox.no/posts/rsa-using-bouncycastle/comment-page-1#comment-853</link>
		<dc:creator>Glen</dc:creator>
		<pubDate>Wed, 25 Aug 2010 15:13:56 +0000</pubDate>
		<guid isPermaLink="false">http://ox.no/?p=80#comment-853</guid>
		<description>&lt;p&gt;Hi Harvard,&lt;/p&gt;

&lt;p&gt;Thanks for this. I was actually able to use your suggestions in blinding messages. However, I can&#039;t seem to go through the whole process of blinding a message, signing it, unblinding the signed message, and verifying the signature. I&#039;ve written these codes: http://www.daniweb.com/forums/post1315685.html#post1315685&lt;/p&gt;

&lt;p&gt;Please, if you could have a look, perhaps you could tell me what I&#039;m doing wrong.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Harvard,</p>

<p>Thanks for this. I was actually able to use your suggestions in blinding messages. However, I can&#8217;t seem to go through the whole process of blinding a message, signing it, unblinding the signed message, and verifying the signature. I&#8217;ve written these codes: <a href="http://www.daniweb.com/forums/post1315685.html#post1315685" rel="nofollow">http://www.daniweb.com/forums/post1315685.html#post1315685</a></p>

<p>Please, if you could have a look, perhaps you could tell me what I&#8217;m doing wrong.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://ox.no/posts/rsa-using-bouncycastle/comment-page-1#comment-835</link>
		<dc:creator>John</dc:creator>
		<pubDate>Tue, 20 Jul 2010 18:33:16 +0000</pubDate>
		<guid isPermaLink="false">http://ox.no/?p=80#comment-835</guid>
		<description>&lt;p&gt;Hi,
I am looking for an infrastructure like JCE in java so I can “install” encryption providers.
The one I am going to put in now is Bouncy Castle provider and use “PBEWITHMD5AND256BITAES-CBC-OPENSSL” but I want to be able to change the providers and algorithms just by configuration change. I have that in Java with JCE.
Is there something like that in C# and are there docs / examples?&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi,
I am looking for an infrastructure like JCE in java so I can “install” encryption providers.
The one I am going to put in now is Bouncy Castle provider and use “PBEWITHMD5AND256BITAES-CBC-OPENSSL” but I want to be able to change the providers and algorithms just by configuration change. I have that in Java with JCE.
Is there something like that in C# and are there docs / examples?</p>

<p>Thanks.</p>]]></content:encoded>
	</item>
</channel>
</rss>

