Usage 1: Generate a self-signed digital certificate
# 生成私钥
openssl genpkey -algorithm RSA -out private.key
# 生成证书请求
openssl req -new -key private.key -out certificate.csr
# 使用私钥签署证书
openssl x509 -req -days 365 -in certificate.csr -signkey private.key -out certificate.crt
Usage 2 generates message digest
# 计算SHA256摘要
echo -n "Hello, world!" | openssl dgst -sha256
Usage 3 Encrypt and decrypt files
# 加密文件
openssl enc -aes-256-cbc -salt -in plaintext.txt -out encrypted.txt
# 解密文件
openssl enc -aes-256-cbc -d -in encrypted.txt -out decrypted.txt
Usage 4: Create a self-signed root certificate and certificate chain
# 生成根证书私钥
openssl genpkey -algorithm RSA -out root.key
# 生成根证书请求
openssl req -new -key root.key -out root.csr
# 自签名根证书
openssl x509 -req -days 365 -in root.csr -signkey root.key -out root.crt
# 创建证书链
cat root.crt > chain.crt
cat intermediate.crt >> chain.crt
Usage 5: Generate random numbers
# 生成随机数
openssl rand -hex 16
https://github.com/pdf2htmlEX/pdf2htmlEX.git