Bouncy Castle 无法在 linux 机器上运行
Bouncy Castle not working on linux machine
我为 fips 投诉签名生成和验证实现了 boucnyCastle,这在 windows 环境中运行良好,但在 linux 环境中,代码卡在密钥对生成上。以下是我编写的代码:
public static KeyPair generateKeyPair() throws GeneralSecurityException
{
KeyPairGenerator keyPair = KeyPairGenerator.getInstance("RSA", "BCFIPS");
keyPair.initialize(new RSAKeyGenParameterSpec(3072, RSAKeyGenParameterSpec.F4));
return keyPair.generateKeyPair();
}
首先检查 rngd.service(硬件 RNG 熵收集器守护程序)是否在您的系统上 运行。如果您使用的是虚拟机,那么它不会 运行 并使用以下 link:
来修复它
http://wiki.networksecuritytoolkit.org/index.php/HowTo_Fix_The_rngd.service
第二次使用命令检查您的系统是否有足够的熵:
cat /proc/sys/kernel/random/entropy_avail
如果你的系统熵不够,那么增加它。您可以使用以下 link:
https://redhatlinux.guru/index.php/2016/04/03/increase-system-entropy-on-rhel-centos-6-and-7/
同时在您的系统上安装 Haveged 以生成人工熵。要安装 Haveged,您可以使用
以下 link:
我为 fips 投诉签名生成和验证实现了 boucnyCastle,这在 windows 环境中运行良好,但在 linux 环境中,代码卡在密钥对生成上。以下是我编写的代码:
public static KeyPair generateKeyPair() throws GeneralSecurityException
{
KeyPairGenerator keyPair = KeyPairGenerator.getInstance("RSA", "BCFIPS");
keyPair.initialize(new RSAKeyGenParameterSpec(3072, RSAKeyGenParameterSpec.F4));
return keyPair.generateKeyPair();
}
首先检查 rngd.service(硬件 RNG 熵收集器守护程序)是否在您的系统上 运行。如果您使用的是虚拟机,那么它不会 运行 并使用以下 link:
来修复它http://wiki.networksecuritytoolkit.org/index.php/HowTo_Fix_The_rngd.service
第二次使用命令检查您的系统是否有足够的熵:
cat /proc/sys/kernel/random/entropy_avail
如果你的系统熵不够,那么增加它。您可以使用以下 link:
https://redhatlinux.guru/index.php/2016/04/03/increase-system-entropy-on-rhel-centos-6-and-7/
同时在您的系统上安装 Haveged 以生成人工熵。要安装 Haveged,您可以使用 以下 link: