OpenSSL是一个开源的加密工具包,提供了许多加密算法和安全协议的实现。在Linux系统中,可以通过OpenSSL命令来使用和管理OpenSSL工具包。以下是一些常用的OpenSSL命令及其用法:
openssl genpkey -algorithm RSA -out private.key
:生成一个RSA算法的私钥。openssl rsa -in private.key -pubout -out public.key
:从私钥中提取公钥。openssl enc -aes-256-cbc -e -in plaintext.txt -out ciphertext.txt -k mypassword
:使用AES-256-CBC算法对文件进行加密。openssl enc -aes-256-cbc -d -in ciphertext.txt -out plaintext.txt -k mypassword
:使用AES-256-CBC算法对文件进行解密。openssl req -new -sha256 -key private.key -out certificate.csr
:生成一个证书请求文件。openssl x509 -req -in certificate.csr -signkey private.key -out certificate.crt
:使用私钥对证书请求文件进行签名。openssl x509 -in certificate.crt -text -noout
:显示证书文件的详细信息。openssl list -cipher-commands
:列出所有支持的加密算法。openssl list -message-digest-commands
:列出所有支持的消息摘要算法。openssl list -public-key-algorithms
:列出所有支持的公钥算法。openssl version
:查看OpenSSL版本信息。openssl rand -base64 32
:生成32字节的随机字符串,常用于加密密钥。openssl dgst -sha256 file.txt
:计算文件的SHA-256哈希值。以上只是OpenSSL命令的一部分,更多命令和详细用法可以参考OpenSSL的官方文档或使用man openssl
命令查看完整的命令手册。
亿速云提供多种品牌、不同类型SSL证书签发服务,包含:域名型、企业型、企业型专业版、增强型以及增强型专业版,单域名SSL证书300元/年起。点击查看>>
推荐阅读:Linux下OpenSSL命令大全及用法