Bouncy Castle not working on linux machine

谁说我不能喝 提交于 2019-12-10 11:10:24

问题


I implemented boucnyCastle for fips complaint signature generation and verification, this worked fine on a windows environment but on a linux environment the code is stuck on keypair generation. Following is the code that i have written:

public static KeyPair generateKeyPair() throws GeneralSecurityException
{
    KeyPairGenerator keyPair = KeyPairGenerator.getInstance("RSA", "BCFIPS");
    keyPair.initialize(new RSAKeyGenParameterSpec(3072, RSAKeyGenParameterSpec.F4));
    return keyPair.generateKeyPair();
}

Bouncy Castle


回答1:


First Check if rngd.service (Hardware RNG Entropy Gatherer Daemon) is running on your system. If you are using Virtual Machine then it will not be running and to fix it use the following link:

http://wiki.networksecuritytoolkit.org/index.php/HowTo_Fix_The_rngd.service

Second check if your system has enough entropy using command:

cat /proc/sys/kernel/random/entropy_avail

if Entropy of your system has not enough Entropy then increase it. you can use the following link:

https://redhatlinux.guru/index.php/2016/04/03/increase-system-entropy-on-rhel-centos-6-and-7/

Also Install Haveged on your system to generate artificial entropy. To install Haveged you can use the following link:

https://www.digitalocean.com/community/tutorials/how-to-setup-additional-entropy-for-cloud-servers-using-haveged



来源:https://stackoverflow.com/questions/47795876/bouncy-castle-not-working-on-linux-machine

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