//生成私鑰
openssl genrsa -out private.pem 1024
//生成公鑰
openssl rsa -in private.pem -pubout -out public.pem
//查看私鑰
openssl rsa -in private.pem -text -out private.txt
//公鑰加密
openssl rsautl -encrypt -in message.txt -inkey public.pem -out enc.txt
//私鑰解密
openssl rsautl -decrypt -in enc.txt -inkey private.pem -out dec.txt
//私鑰簽名
openssl rsautl -sign -in message.txt -inkey private.pem -out enc.txt
// 公鑰驗(yàn)證
openssl rsautl -verify -in enc.txt -inkey public.pem -out dec.txt
//生成請求文件
openssl req -new -key private.pem -out rsacert.csr
//生成crt證書
openssl x509 -req -days 365 -in rsacert.csr -signkey private.pem -out rsacert.crt
//生成der證書
openssl x509 -outform der -in rsacert.crt -out rsacert.der
//生成p12文件
openssl pkcs12 -export -out p.p12 -inkey private.pem -in rsacert.crt