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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:57:05+00:00 2026-05-26T10:57:05+00:00

From what I can see, Microsoft’s RSA CSP always generates identical bitlength pseudo prime

  • 0

From what I can see, Microsoft’s RSA CSP always generates identical bitlength pseudo prime numbers. So if the key size is 1024, the P and Q values seem to be (?) guaranteed to be 512 bits each? Does anyone know for sure if this, in fact, is the case?

I’m building an interoperability module between my own RSA implementation and Microsoft’s. In my case I have built in a small random variance between P & Q values so for 1024 bit key I could end up with one value being 506 bits and the other 518. On purely experimental basis, if I lock the variance to 0 (i.e. the P & Q values are equal in size) — Things work the way they should, I soon as I make the size variable Microsoft RSA object responds with “Bad Data” during import process.

I’m looking for a confirmation that Microsoft enforces equal key sizes, so if anyone has any information on it, please post

Before someone has a chance to ask why I had to implement my own RSA provider : CryptoAPI doesn’t play nice in a multithreaded environment, it locks the machine keystore on CryptoServiceProvider calls; which means “File not found” (rather cryptic) errors if accessed from multiple threads

For those that care, take a look here: http://blogs.msdn.com/b/alejacma/archive/2007/12/03/rsacryptoserviceprovider-fails-when-used-with-asp-net.aspx

  • 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-26T10:57:06+00:00Added an answer on May 26, 2026 at 10:57 am

    Microsoft’s RSA CSP generates and uses private keys which it can export and import in the format described on this page, and looks like this:

    BLOBHEADER blobheader;
    RSAPUBKEY rsapubkey;
    BYTE modulus[rsapubkey.bitlen/8];
    BYTE prime1[rsapubkey.bitlen/16];
    BYTE prime2[rsapubkey.bitlen/16];
    BYTE exponent1[rsapubkey.bitlen/16];
    BYTE exponent2[rsapubkey.bitlen/16];
    BYTE coefficient[rsapubkey.bitlen/16];
    BYTE privateExponent[rsapubkey.bitlen/8];
    

    So private keys that the CSP can handle (and in particular generate) must have the following properties:

    • The modulus length, in bits, must be a multiple of 16.
    • The length of each prime factor must be no more than half the length of the modulus.
    • The private exponent must not be longer than the modulus.
    • The private exponent, reduced modulo p-1 (resp. q-1) must be no longer than half the modulus.

    Technically, there are infinitely many possible values for the private exponent d, and similarly for exponent1 and exponent2 because all that mathematically matters are the value of d modulo p-1 and q-1; it has been suggested to accept slightly longer private exponent parts if they end up with a lower Hamming weight, because this would lead to some performance benefits. Bottom-line: the format described above will not let you do that.

    Other characteristics that the key must have to be acceptable to Microsoft’s code (but not directly reported in the description above):

    • The numerical value of the first prime (p, aka prime1) must be greater than the numerical value of the second prime (q, aka prime2).
    • The public exponent (here encoded within the rsapubkey field) must fit in a 32-bit integer (unsigned).

    Therefore there are many RSA key pairs which are nominally valid as per the RSA standard, but which cannot be handled by Microsoft RSA CSP code. Noteworthy is the last constraint, on the public exponent size: this means that the constraint is more general than just the CSP; if you setup a SSL server where the server’s public key (in its certificate) has a public exponent which does not fit in 32 bits, then Internet Explorer will not be able to connect to it.

    So, in practice, if you generate RSA key pairs, you will have to make sure that they comply with the rules above. Do not worry: to the best of our knowledge, these rules do not lower security.

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

Sidebar

Related Questions

While HTML Scraping is pretty well-documented from what I can see, and I understand
I have some really funky code. As you can see from the code below
As you can see this is a question from a non web developer. I
From a security perspective, I can see simply doing an 'eval' on incoming JSON
How can I remove the animation from this jQuery modal window? You can see
From http://developer.yahoo.com/yui/docs/YAHOO.util.DataSourceBase.html#method_sendRequest , you can see the oCallback is an object literal with the
I'm making this method retrieve records from the Data Base. As you can see
Say a table has several subclass types. How can I see all columns from
I can get easily see what projects and dlls a single project references from
On the production server, I can see this event from system Event Viewer when

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.