带有自签名证书的随机数错误

时间:2019-01-12 20:26:57

标签: openssl self-signed

我一直在尝试创建自签名证书,但是我不断收到与随机数生成器有关的错误。我在终端输入了

openssl req -x509 -days 365 -sha256 -newkey rsa:4096 -keyout mycert.pem -out mycert.pem

然后我得到提示输入我的信息。我完全可以解决这个问题,但是当我按Enter键时,出现以下错误:

Cannot write random bytes:

139680915939776:error:2407007A:random number generator:RAND_write_file:Not a regular file:crypto/rand/randfile.c:163:Filename=/home/user/.rnd

2 个答案:

答案 0 :(得分:0)

通过使用以下代码代替/ usr / share / dovecot / dovecot-openssl.cnf 内容,解决了该问题:

[ req ]
default_bits = 2048
encrypt_key = yes
distinguished_name = req_dn
x509_extensions = cert_type
prompt = no

[ req_dn ]
# country (2 letter code)
#C=FI

# State or Province Name (full name)
#ST=

# Locality Name (eg. city)
#L=Helsinki

# Organization (eg. company)
#O=Dovecot

# Organizational Unit Name (eg. section)
OU=IMAP server

# Common Name (*.example.com is also possible)
CN=imap.example.com

# E-mail contact
emailAddress=postmaster@example.com

[ cert_type ]
nsCertType = server

答案 1 :(得分:0)

可能不允许您与运行该命令的用户一起写/home/user/.rnd

您可能要检查您的访问权限,或者是否存在/home/user