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 8925953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:50:14+00:00 2026-06-15T07:50:14+00:00

I was using below code for encryption in my project and everything was working

  • 0

I was using below code for encryption in my project and everything was working fine.

RSACryptoServiceProvider x_alg = new RSACryptoServiceProvider(  );

// export only the public key 
RSAParameters x_public_params = x_alg.ExportParameters(false);

// export the private key 
RSAParameters x_private_params = x_alg.ExportParameters(true);

Now client changed the requirement and he want to store all the RSAParameters value into config file and provided below details for demo

<project name="netCard Server1">
  <key length="256"></key>
  <D length="64">00000000000000000000000000000000000000000000000000000000000019C5</D>
  <DP length="32">00000000000000000000000000000061</DP>
  <DQ length="32">00000000000000000000000000000065</DQ>
  <Exponent length="6">000DCD</Exponent>
  <InverseQ length="32">0000000000000000000000000000003B</InverseQ>
  <Modulus length="64">0000000000000000000000000000000000000000000000000000000000002C95</Modulus>
  <P length="32">00000000000000000000000000000065</P>
  <Q length="32">00000000000000000000000000000071</Q>
  <text length ="64">0123456789ABCDEF111111111111111125FE2222222222222233333333334444</text>
  <cipher length ="64">0000000000000000000000000000000000000000000000000000000000000000</cipher>
</project>

Now,the problem is that when I am importing the RSAParameters value,I am getting Bad Data Exception

  • 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-15T07:50:15+00:00Added an answer on June 15, 2026 at 7:50 am

    The problem that you have is that the XML that your customer has given you is not in the format required to deserialize to an object of type RSAParameters

    I’ve run this code to show what the XML generated by the XML serializer looks like

    var provider = new RSACryptoServiceProvider();
    
    var parameters = provider.ExportParameters(true);
    
    var x = new XmlSerializer(parameters.GetType());
    x.Serialize(Console.Out, parameters);
    Console.WriteLine();
    

    The output that it generates is something like:

    <RSAParameters>
      <Exponent>AQAB</Exponent>
      <Modulus>ruCEpD3XnR...g/waE=</Modulus>
      <P>90amUU3dDazsqN9+...jJUQ==</P>
      <Q>tQv5hGehNLLmv4aC...NfUQ==</Q>
      <DP>azJiiZ6itPoBQph...zBcQ==</DP>
      <DQ>OmewiOw9bxi/o82...f44Q==</DQ>
      <InverseQ>wNohk0NNl...YDg==</InverseQ>
      <D>fNOOWp46FckcvtI+...PpXAE=</D>
    </RSAParameters>
    

    where the … is truncated output. What your customer has supplied looks like a superset of that (key, text and cipher are not in the parameter list) but the format is a bit different.

    You can either ask them to supply the data in exactly the required format then serialize from that; or you can accept their format, deserialize it to XML and build the RSAParameters object manually by mapping the XML content to the appropriate fields on the RSAParameters object. You also need to work out what it is that they want to do with the key, text and cipher data as these will be lost in this process.

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

Sidebar

Related Questions

I am using below code to show jquery dialog, its working perfectly, Sub OpenDialog(ByVal
I am creating excel file using below code public class ResultSetToExcel { private HSSFWorkbook
I am using below code to get new inserted ID in auto identity column
I am using below code to get calendar events in my application. It's working
i using below code to get a picture from URL: URL url=new URL(http://www.google.com/images/logos/ps_logo2.png); InputStream
I am using below code to send email it works fine most of the
I am using below code snippet to validate my input string with: only capital
i am using below code , Its displaying the ??? only in place of
I am using below code to upload excel and INSERT in mysql in php
I am using below code to get profile image of friends using Resfb. I

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.