Is there a limit for RSA key exponents in .NET?

后端 未结 1 1735
无人及你
无人及你 2020-12-20 04:03

Using C# I cannot import a public RSA key with an exponent of {1, 0, 0, 0, 15}: There is an exception:

System.Security.Cryptography.CryptographicException wa         


        
相关标签:
1条回答
  • 2020-12-20 05:04

    The default provider by Microsoft only supports public key exponents of a specific size, as CodesInChaos mused:

    CNG is more flexible with regard to RSA key pairs. For example, CNG supports public exponents larger than 32-bits in length, and it supports keys in which p and q are different lengths.

    and

    Please, note that the restriction of 4 byte exponents are for MS CSPs only. CryptoAPI should be able to work with 5 byte exponents if using a third-party CSP.

    Sources:

    • http://blogs.msdn.com/b/alejacma/archive/2010/07/28/cryptoapi-and-5-bytes-exponent-public-keys.aspx
    • source of source: http://msdn.microsoft.com/en-us/library/bb204778%28VS.85%29.aspx
    0 讨论(0)
提交回复
热议问题