BouncyCastle, how long should it take to generate a RSA keypair?

旧城冷巷雨未停 提交于 2019-12-08 02:43:26

问题


I'm using Bouncy Castle (c#/vb.net version) and generating a 4096-byte RSA Keypair to use in my certificate with this routine:

Public Shared Function GenerateRSAKeypair(keylength As Integer) As AsymmetricCipherKeyPair
    Dim r As New RsaKeyPairGenerator()
    r.Init(New KeyGenerationParameters(New SecureRandom(), keylength))
    Dim keys As AsymmetricCipherKeyPair = r.GenerateKeyPair()
    Return keys
End Function

The procedure works ok, however it takes a very long time, up to one minute (I'm on a 2.4ghz pentium DualCore).

Since I don't have much experience (almost none really) with RSA and all these things, I just wanted to ask if it's normal that it takes so long to generate the key, or if I'm doing something wrong.

Thanks in advance!


回答1:


After reading some theory about RSA, I can confirm there's nothing wrong with the code, it simply takes that long to generate such a big key.



来源:https://stackoverflow.com/questions/10507634/bouncycastle-how-long-should-it-take-to-generate-a-rsa-keypair

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!