如何修复“无法写入‘随机状态’"在openssl中 [英] How to fix "unable to write 'random state' " in openssl

查看:13
本文介绍了如何修复“无法写入‘随机状态’"在openssl中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此命令生成私钥时

genrsa -out my-prvkey.pem 1024

它抛出如下错误

将屏幕"加载到随机状态 -done 生成 RSA 私有密钥,1024 位长模数......................................................++++++++........................++++++++++ 无法写入随机状态"e是 65537 (0*10001)

Loadind 'screen' into random state -done Generating RSA private key,1024 bit long modulus .........................................+++++++ ...........................+++++++++ unable to write 'random state' e is 65537 (0*10001)

这在创建公共证书时会产生任何问题.我在 Windows 中运行这个命令.谁能帮我解决这个问题?

This makes any problem while creating a public certificate. I'm running this command in windows. Can anyone help me for the fix?

推荐答案

最快的解决方案是:将环境变量 RANDFILE 设置为可以写入随机状态"文件的路径(当然检查文件访问权限),例如.在您的命令提示符中:

The quickest solution is: set environment variable RANDFILE to path where the 'random state' file can be written (of course check the file access permissions), eg. in your command prompt:

set RANDFILE=C:MyDir.rnd
openssl genrsa -out my-prvkey.pem 1024

更多解释:Windows 上的 OpenSSL 尝试按以下顺序保存随机状态"文件:

More explanations: OpenSSL on Windows tries to save the 'random state' file in the following order:

  1. 取自RANDFILE环境变量的路径
  2. 如果设置了 HOME 环境变量,则:${HOME}.rnd
  3. C:.rnd
  1. Path taken from RANDFILE environment variable
  2. If HOME environment variable is set then : ${HOME}.rnd
  3. C:.rnd

我很确定,在您的情况下,它最终会尝试将其保存在 C:.rnd 中(并且由于缺乏足够的访问权限而失败).不幸的是,OpenSSL 不会打印实际尝试在任何错误消息中使用的路径.

I'm pretty sure that in your case it ends up trying to save it in C:.rnd (and it fails because lack of sufficient access rights). Unfortunately OpenSSL does not print the path that is actually tries to use in any error messages.

这篇关于如何修复“无法写入‘随机状态’"在openssl中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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