BouncyCastle,生成RSA密钥对需要多长时间? [英] BouncyCastle, how long should it take to generate a RSA keypair?

查看:458
本文介绍了BouncyCastle,生成RSA密钥对需要多长时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Bouncy Castle(c#/ vb.net版本),并通过以下例程生成要在我的证书中使用的4096字节RSA密钥对:

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

该过程正常,但是要花很长时间,最多一分钟(我使用的是2.4GHz奔腾DualCore)。

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

我对RSA和所有这些东西没有太多的经验(几乎没有),我只是想问问生成密钥花这么长时间是否正常,或者我做错了什么。

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.

预先感谢!

推荐答案

在阅读了有关RSA的一些理论之后,我可以确认没错代码,只需这么长时间即可生成如此大的密钥。

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.

这篇关于BouncyCastle,生成RSA密钥对需要多长时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆