RE: RSACryptoServiceProvider error with message "Illegal key size for this algorithm"

From: Shawn Farkas (shawnfa_at_online.microsoft.com)
Date: 04/23/04


Date: Thu, 22 Apr 2004 23:44:09 GMT

Hi Johan,

        The RSACryptoServiceProvider class is actually a pretty thin wrapper around Windows' CAPI implementation of RSA. Since CAPI
delegates its work to various crytpo service providers, the RSACryptoServiceProvider can provide no stronger protection than the CSP installed
on your machine. Check to see if you've got the enhanced CSP installed on the Win9x machine, by checking to see if rsaenh.dll is on your system.
You can also check the IE help->about dialog box to check to see what the encryption strength is on your machine.

I've also written a blog posting on how to detect which CSP you have installed:
http://blogs.msdn.com/shawnfa/archive/2004/03/08/86233.aspx

Mitch Gallant has a utility that can do the same:
http://www.jensign.com/JavaScience/ListAlgs/

-Shawn
http://blogs.msdn.com/shawnfa

-- 
This posting is provided "AS IS" with no warranties, and confers no rights.
Note:  For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they 
originated.  
--------------------
>From: JohanG@pronet.com.au (joewu)
>Newsgroups: microsoft.public.dotnet.security
>Subject: RSACryptoServiceProvider error with message "Illegal key size for this algorithm"
>Date: 21 Apr 2004 22:49:03 -0700
>Organization: http://groups.google.com
>Lines: 10
>Message-ID: <ec0f2656.0404212149.19e88315@posting.google.com>
>NNTP-Posting-Host: 150.101.146.202
>Content-Type: text/plain; charset=ISO-8859-1
>Content-Transfer-Encoding: 8bit
>X-Trace: posting.google.com 1082612943 4215 127.0.0.1 (22 Apr 2004 05:49:03 GMT)
>X-Complaints-To: groups-abuse@google.com
>NNTP-Posting-Date: Thu, 22 Apr 2004 05:49:03 +0000 (UTC)
>Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!news.glorb.com!
postnews1.google.com!not-for-mail
>Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.security:5813
>X-Tomcat-NG: microsoft.public.dotnet.security
>
>Hi,
>   I have use RSACryptoServiceProvider in my application program, it
>works fine in Windows 2000 and XP. But when I tried it out in windows
>98, it throws an exception "Illegal key size for this algorithm". I
>have search the Internet for this exception, but it does not appear to
>be a solution for it. I am using IE version 6 SP 1 in windows 98.
>Please help.
>
>TIA.
>Johan
>


Relevant Pages

  • Strong encryption with RSACryptoServiceProvider..?
    ... Does anyone know how to encrypt more than 16 bytes with the ... RSACryptoServiceProvider on Windows 98? ... Byte array is too large. ... I suspect that the RSACryptoServiceProvider uses the Microsoft Base CSP on ...
    (microsoft.public.platformsdk.security)
  • Strong encryption with RSACryptoServiceProvider..?
    ... Does anyone know how to encrypt more than 16 bytes with the ... RSACryptoServiceProvider on Windows 98? ... Byte array is too large. ... I suspect that the RSACryptoServiceProvider uses the Microsoft Base CSP on ...
    (microsoft.public.dotnet.security)
  • RSACryptoServiceProvider error with message "Illegal key size for this algorithm"
    ... I have use RSACryptoServiceProvider in my application program, ... works fine in Windows 2000 and XP. ... it throws an exception "Illegal key size for this algorithm". ... TIA. ...
    (microsoft.public.dotnet.security)
  • Re: Strong encryption with RSACryptoServiceProvider..?
    ... > Does anyone know how to encrypt more than 16 bytes with the ... > RSACryptoServiceProvider on Windows 98? ... It appears to be a bug in the RSACryptoServiceProvider. ...
    (microsoft.public.platformsdk.security)
  • Unhadelded Exception Occurs When using RSACryptoServiceProvider
    ... Simply I am trying to use RSACryptoServiceProvider to generate a key ... encrypt it with my public key, send the encrypted data back for me to ... an unhandled exception is fired somewhere in the Crypto Service ... string encryptedData = GetSecureData; ...
    (microsoft.public.dotnet.framework.aspnet)