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

  • SEARCH
  • Home
  • 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 8999959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:14:57+00:00 2026-06-16T00:14:57+00:00

If RSACryptoServiceProvider cannot Encrypt data larger than it’s KeySize , how RsaProtectedConfigurationProvider is implemented

  • 0

If RSACryptoServiceProvider cannot Encrypt data larger than it’s KeySize, how RsaProtectedConfigurationProvider is implemented in the .Net framework?

I am working on a utility that is going to be used to encrypt/decrypt some sensitive information. My two encryption provider options are DPAPI and RSA, while DPAPI not suited for web farm kind of environment, RSA is fits because of the Export/Import options with a KeyContainer. This is a stand alone application running on a workstation.

As I am aware that Asymmetric algorithms are not designed for large data, I just tried encrypting a string of length over 400K using the code below and it works well.

        if (!section.SectionInformation.IsProtected)
        {
            section.SectionInformation.ProtectSection("RSAProtectedConfigurationProvider");
            section.SectionInformation.ForceSave = true;
            config.Save(ConfigurationSaveMode.Full);
        }

Definitely this implies that more things are happening behind the scenes apart from the export import key options in aspnet_regiis.exe.

My understanding:

  1. we encrypt myapp.exe.config with RsaProtectedConfigurationProvider, provide a key container name myrsakeycontainer, and export the public and private keys to an xml file myrsakeyfile.xml.

  2. If we want myapp.exe.config to be decrypted in another computer, we import they keypair from myrsakeyfile.xml with a container named myrsakeycontainer.

this works well. I can achieve the same thing in my project via RSACryptoServiceProvider. But I can’t handle data that larger than the key size that
new RSACryptoServiceProvider(cspParameters)
generated for me.

  • I want to be able to decrypt huge data (just in case) just the way
    RsaProtectedConfigurationProvider does.
  • Yes I could use a RijndaelManaged (my favorite) for actual
    encryption and for the symmetric key transport (export/import) I
    could use the RSACryptoServiceProvider. This leaves me in a
    situation that If I want to export/import the symmetric key, I should
    first encrypt it with the public key or RSA, import it to another
    machine, decrypt with the private key of RSA. Which is export the RSA
    key pair along with the encrypted symmetric key.
  • But, when I export RSA key pair used by
    RsaProtectedConfigurationProvider via aspnet_regiis.exe, I
    believe that it exports only the public/private key pair in an xml
    file and no other information (like the symmetric key information).

  • So, with just the RSA key pair, how does
    RsaProtectedConfigurationProvider manage to derypt (huge – over
    400K chars in my case) information that was encrypted on another
    computer? In cases it uses a symmetric algorithm (perhaps?!) to
    encrypt information, how is that symmetric key exported/imported to another
    computer for decryption? Is that symmetric key part of the RSA key container exported via aspnet_regiis.exe or is the symmetric key is contrived dynamic based on an algorithm?

  • I could get away with a Rijndael, whose key is encrypeted with an RSA
    key pair and I can export/import both the RSA key pair and the
    Rijndael symmetric key to another computer. (which I have done in the past)

    I am interested to know what is used inside
    RsaProtectedConfigurationProvider.

Any theories? concepts? links? recommendations? please..

Similar Question – What algorithms are used by RSAProtectedConfigurationProvider in web.config encyrption?

  • 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-06-16T00:14:58+00:00Added an answer on June 16, 2026 at 12:14 am

    The encrypted symmetric key is stored in the XML alongside the encrypted configuration information that the symmetric key has encrypted.

    If you use Reflector to look at the code, what it does is load the XML node and use the asymmetric RSA private key to decrypt a symmetric key stored within the XML node itself.

    The function that actually does this magic is here:

    public virtual SymmetricAlgorithm GetDecryptionKey(EncryptedData encryptedData, string symmetricAlgorithmUri);

    Declaring Type: System.Security.Cryptography.Xml.EncryptedXml
    Assembly: System.Security, Version=2.0.0.0

    See the code around

    this.m_document.SelectNodes("//enc:EncryptedKey", nsmgr);
    

    This blog post has a nice writeup about how you pair Asymmetric and Symmetric algorithms in real-world practice: http://pages.infinit.net/ctech/20031101-0151.html

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

Sidebar

Related Questions

I want to encrypt some server data using .NET's RSACryptoServiceProvider and decrypt it when
I use RSACryptoServiceProvider to encrypt some small blocks of data. For the solution I'm
I know that RSACryptoServiceProvider can encrypt with the public key, then it can be
I encrypt and decrypt data using the RSACryptoServiceProvider in C#, and when I generate
I have read on MSDN( see Important note ) that RSACryptoServiceProvider must be disposed.
I'm trying to encrypt an array of 256 bytes by using RSACryptoServiceProvider but I'm
I'm trying to encrypt and decrypt data using RSA in C#. I have the
I am writing some C# encrypting that is decrypted by php. They aren't working
My ultimate goal is to create a URL that is unique and cannot be
I am having a strange problem. I am working on a .net windows project

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.