<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Using RSACryptoServiceProvider for RSA-SHA256 signatures</title><link>http://blogs.msdn.com/shawnfa/archive/2008/08/25/using-rsacryptoserviceprovider-for-rsa-sha256-signatures.aspx</link><description>Earlier this month, we released .NET 3.5 SP 1 .&amp;#160; One of the new features available in this update is that RSACryptoServiceProvider has gained the ability to create and verify RSA-SHA256 signatures. Since RSACryptoServiceProvider relies on the underlying</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Using RSACryptoServiceProvider for RSA-SHA256 signatures</title><link>http://blogs.msdn.com/shawnfa/archive/2008/08/25/using-rsacryptoserviceprovider-for-rsa-sha256-signatures.aspx#9581541</link><pubDate>Fri, 01 May 2009 02:41:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9581541</guid><dc:creator>Balazs</dc:creator><description>&lt;p&gt;Could you tell me, why an actually existing private key wont't work with this method (on any current OS)&lt;/p&gt;
&lt;p&gt;X509Store _windowsStore = new X509Store( StoreName.My , StoreLocation.CurrentUser );&lt;/p&gt;
&lt;p&gt;_windowsStore.Open(OpenFlags.MaxAllowed); // for the sake of testing&lt;/p&gt;
&lt;p&gt;X509Certificate2 _cachedCert = _windowsStore.Certificates[0];&lt;/p&gt;
&lt;p&gt;RSACryptoServiceProvider _provider = null;&lt;/p&gt;
&lt;p&gt;byte[] data = new byte[] { 0, 1, 2, 3, 4, 5 };&lt;/p&gt;
&lt;p&gt;// CASE A, I'd like it to work&lt;/p&gt;
&lt;p&gt;if (_cachedCert.HasPrivateKey)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	_provider = (RSACryptoServiceProvider)_cachedCert.PrivateKey;&lt;/p&gt;
&lt;p&gt;	// This will throw {System.Security.Cryptography.CryptographicException}&lt;/p&gt;
&lt;p&gt;	// &amp;quot;Invalid algorithm specified.\r\n&amp;quot;&lt;/p&gt;
&lt;p&gt;	byte[] sigedBytes = _provider.SignData(data, &amp;quot;SHA256&amp;quot;);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;// CASE B, This works, this was your example&lt;/p&gt;
&lt;p&gt;_provider = new RSACryptoServiceProvider();&lt;/p&gt;
&lt;p&gt;byte[] sigedBytes2 = _provider.SignData(data, &amp;quot;SHA256&amp;quot;);&lt;/p&gt;</description></item><item><title>re: Using RSACryptoServiceProvider for RSA-SHA256 signatures</title><link>http://blogs.msdn.com/shawnfa/archive/2008/08/25/using-rsacryptoserviceprovider-for-rsa-sha256-signatures.aspx#9627158</link><pubDate>Tue, 19 May 2009 10:19:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9627158</guid><dc:creator>Ronak jain </dc:creator><description>&lt;p&gt;We can also print in a message box , why to use console ?&lt;/p&gt;</description></item><item><title>re: Using RSACryptoServiceProvider for RSA-SHA256 signatures</title><link>http://blogs.msdn.com/shawnfa/archive/2008/08/25/using-rsacryptoserviceprovider-for-rsa-sha256-signatures.aspx#9634324</link><pubDate>Fri, 22 May 2009 00:10:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9634324</guid><dc:creator>shawnfa</dc:creator><description>&lt;p&gt;I tend to use the console in my sample code since it doesn't require any additional dependencies.&lt;/p&gt;
&lt;p&gt;-Shawn&lt;/p&gt;
</description></item><item><title>re: Using RSACryptoServiceProvider for RSA-SHA256 signatures</title><link>http://blogs.msdn.com/shawnfa/archive/2008/08/25/using-rsacryptoserviceprovider-for-rsa-sha256-signatures.aspx#9634334</link><pubDate>Fri, 22 May 2009 00:16:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9634334</guid><dc:creator>shawnfa</dc:creator><description>&lt;p&gt;You need to make sure that the RSA key is stored in the PROV_RSA_AES crypto service provider. &amp;nbsp;If your certificate is using PROV_RSA_FULL, then that CSP doesn't understand SHA-256, and the signature process won't work.&lt;/p&gt;
&lt;p&gt;-Shawn&lt;/p&gt;
</description></item><item><title>re: Using RSACryptoServiceProvider for RSA-SHA256 signatures</title><link>http://blogs.msdn.com/shawnfa/archive/2008/08/25/using-rsacryptoserviceprovider-for-rsa-sha256-signatures.aspx#9807544</link><pubDate>Sun, 28 Jun 2009 21:43:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9807544</guid><dc:creator>Pete R</dc:creator><description>&lt;p&gt;Hi Shawn,&lt;/p&gt;
&lt;p&gt;It seems this might still run afoul of this knowledgebase issue with regard to delays incurred while calling the SignData method: &lt;a rel="nofollow" target="_new" href="http://support.microsoft.com/kb/948080"&gt;http://support.microsoft.com/kb/948080&lt;/a&gt;. I need to sign cookies for a very high-traffic website and such delays would be unacceptable. Is there a way to do RSA-SHA256 while still avoiding this issue? Thanks!&lt;/p&gt;</description></item></channel></rss>