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

问题描述 投票:3回答:2

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

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

然后我得到提示输入我的信息。我很好,但按回车键时出现以下错误:

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
openssl self-signed
2个回答
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
[email protected]

[ cert_type ]
nsCertType = server

0
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.