【问题标题】:Can't load /root/.rnd into RNG无法将 /root/.rnd 加载到 RNG 中
【发布时间】:2020-09-15 01:07:50
【问题描述】:

我想使用 Windows Open SSL 生成服务器证书。

当我运行这个命令行时,它会出现这个错误。我该怎么办?

命令

:
openssl req -new -x509 -days 3650 -key ca.key -out ca.crt

错误:

Can't load ./.rnd into RNG 10504:error:2406F079:random number generator:RAND_load_file:Cannot open file:crypto\rand\randfile.c:98:Filename=./.rnd

我也尝试查找 openssl 配置文件,但不,我没有那个文件。

【问题讨论】:

    标签: openssl ssl-certificate client-certificates


    【解决方案1】:

    尝试在/etc/ssl/openssl.cnf 中删除或评论RANDFILE = $ENV::HOME/.rnd

    【讨论】:

    【解决方案2】:

    原因: 默认情况下,“-rand”选项告诉您在操作系统中的某处使用随机文件 .rnd。 由于用户问题使用不存在的 .rnd 文件!!!!

    补救措施: 如果 .rnd 文件不存在,则添加 -writerand 以写入。

    例如:

    root@CentOS:/usr/local/etc/openldap/private # openssl genrsa -rand -genkey -out cert.key 2048
    Can't load -genkey into RNG
    546983936:error:2406F079:random number generator:RAND_load_file:Cannot open file:/usr/src/crypto/openssl/crypto/rand/randfile.c:98:Filename=-genkey
    

    添加-writerand后

    root@CentOS:/usr/local/etc/openldap/private # openssl genrsa -writerand -genkey -out cert.key 2048
    Generating RSA private key, 2048 bit long modulus (2 primes)
    ...........................+++++
    ..............+++++
    e is 65537 (0x010001)
    root@CentOS:/usr/local/etc/openldap/private # 
    

    我自己会再次遇到这个错误。当然我会先检查 StackOverflow(R6000 哈哈)!!!

    【讨论】:

    【解决方案3】:

    我在 Ubuntu 18.04 上使用 OpenVPN Road Warrior 脚本时遇到了这个问题。

    解决方案是手动创建文件,然后脚本就可以完美运行了。

    cd /etc/openvpn/easy-rsa/pki
    openssl rand -writerand .rnd
    

    【讨论】:

    • 这似乎是最简单的解决方案,对我有用!我并不热衷于修改我不太了解的配置文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-23
    • 2021-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多