Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4615376
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:49:52+00:00 2026-05-22T01:49:52+00:00

I’m getting a System.ArgumentException Value was invalid when calling RSACryptoServiceProvider.SignData with the following code:

  • 0

I’m getting a System.ArgumentException “Value was invalid” when calling RSACryptoServiceProvider.SignData with the following code:

var csp = (RSACryptoServiceProvider)_certificate.PrivateKey;
string simpleName = CryptoConfig.MapNameToOID("SHA256");
return csp.SignData(data, simpleName);

The code is from a third party sample so it should work in the right circumstances. It seems it could be caused by my OS but I haven’t found a solution so thought I’d post here to see if someone can help?

.NET Framework: 3.5
OS: Microsoft Windows Server 2003 R2 Enterprise Edition Service Pack 2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:49:53+00:00Added an answer on May 22, 2026 at 1:49 am

    From the link provided:

    “The root cause for this is that the CryptoConfig does not understand SHA256CryptoServiceProvider. It was added as part of the green bits in .NET 3.5, and due to layering restrictions the red bits (such as mscorlib.dll where RSACryptoServiceProvider lives) does not know about its existence…

    If you are using .Net Framework 4.0 then the resolution is to modify the “machine.config” file at:

    %WINDIR%\Microsoft.NET\Framework\v4.0.xxxxx\ CONFIG  -> for x86
    %WINDIR%\Microsoft.NET\Framework64\v4.0.xxxxx\CONFIG -> for x64
    

    If you are using .Net Framework 3.5 then the resolution is to modify the “machine.config” file at:

    %WINDIR%\Microsoft.NET\Framework\v2.0.xxxxx\ CONFIG  -> for x86
    %WINDIR%\Microsoft.NET\Framework64\v2.0.xxxxx\CONFIG -> for x64
    

    Here is the entry that you need to make at the “machine.config” file for supporting SHA256CryptoServiceProvider, SHA256Cng, SHA384CryptoServiceProvider, SHA384Cng, SHA512CryptoServiceProvider, and SHA512Cng.”

    <mscorlib>
        <cryptographySettings>
          <cryptoNameMapping>
            <cryptoClasses>
              <cryptoClass SHA256CSP="System.Security.Cryptography.SHA256CryptoServiceProvider, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <cryptoClass SHA256CNG="System.Security.Cryptography.SHA256Cng, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <cryptoClass SHA384CSP="System.Security.Cryptography.SHA384CryptoServiceProvider, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <cryptoClass SHA384CNG="System.Security.Cryptography.SHA384Cng, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <cryptoClass SHA512CSP="System.Security.Cryptography.SHA512CryptoServiceProvider, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
              <cryptoClass SHA512CNG="System.Security.Cryptography.SHA512Cng, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            </cryptoClasses>
            <nameEntry name="SHA256" class="SHA256CSP" />
            <nameEntry name="SHA256CryptoServiceProvider" class="SHA256CSP" />
            <nameEntry name="System.Security.Cryptography.SHA256CryptoServiceProvider" class="SHA256CSP" />
            <nameEntry name="SHA256Next" class="SHA256CNG" />
            <nameEntry name="SHA256Cng" class="SHA256CNG" />
            <nameEntry name="System.Security.Cryptography.SHA256Cng" class="SHA256CNG" />
            <nameEntry name="SHA384" class="SHA384CSP" />
            <nameEntry name="SHA384CryptoServiceProvider" class="SHA384CSP" />
            <nameEntry name="System.Security.Cryptography.SHA384CryptoServiceProvider" class="SHA384CSP" />
            <nameEntry name="SHA384Next" class="SHA384CNG" />
            <nameEntry name="SHA384Cng" class="SHA384CNG" />
            <nameEntry name="System.Security.Cryptography.SHA384Cng" class="SHA384CNG" />
            <nameEntry name="SHA512" class="SHA512CSP" />
            <nameEntry name="SHA512CryptoServiceProvider" class="SHA512CSP" />
            <nameEntry name="System.Security.Cryptography.SHA512CryptoServiceProvider" class="SHA512CSP" />
            <nameEntry name="SHA512Next" class="SHA512CNG" />
            <nameEntry name="SHA512Cng" class="SHA512CNG" />
            <nameEntry name="System.Security.Cryptography.SHA512Cng" class="SHA512CNG" />
          </cryptoNameMapping>
          <oidMap>
            <oidEntry OID="2.16.840.1.101.3.4.2.1" name="SHA256" />
            <oidEntry OID="2.16.840.1.101.3.4.2.1" name="SHA256Next" />
            <oidEntry OID="2.16.840.1.101.3.4.2.2" name="SHA384" />
            <oidEntry OID="2.16.840.1.101.3.4.2.2" name="SHA384Next" />
            <oidEntry OID="2.16.840.1.101.3.4.2.3" name="SHA512" />
            <oidEntry OID="2.16.840.1.101.3.4.2.3" name="SHA512Next" />
          </oidMap>
        </cryptographySettings>
      </mscorlib> 
    

    Link: http://blogs.msdn.com/b/winsdk/archive/2010/08/18/getting-a-system-argumentexception-value-was-invalid-when-trying-to-sign-data-using-sha256cryptoserviceprovider.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a JSP page retrieving data and when single or double quotes are
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.