网站首页 > java教程 正文
openssl genrsa -out ./privateKey.pem -passout pass:"123123" -des3 1024
openssl rsa -pubout -in ./privateKey.pem -passin pass:"123123" -out ./publicKey.pem
生成本地数字证书
keytool -genkeypair -keyalg RSA -keysize 2048 -sigalg SHA1withRSA -validity 36000 -alias www.xg.com -keystore xg.keystore
导出数字证书
keytool -exportcert -alias www.xg.com -keystore xg.keystore -file xg.cer -rfc
-rfc 指定以Base64编码格式输出
打印证书内容
keytool -printcert -file xg.cer
生成数字证书签发申请
keytool -certreq -alias www.xg.com -keystore xg.keystore -file xg.csr -v
导入数字证书
keytool -importcert -trustcacerts -alias www.xg.com -file xg.cer -keystore xg.keystore
列出密钥库中的条目
keytool -list -alias www.xg.com -keystore xg.keystore
生成pfx证书:
1、openssl genrsa -des3 -out server.key 1024
2、openssl req -new -x509 -key server.key -out server.crt -days 3650 -config "c:\usr\local\ssl\openssl.cnf"
3、openssl pkcs12 -export -out blt.pfx -inkey server.key -in blt.crt
生成pfx证书
生成 CA 根证书,做签名使用的,因为我们是自己给自己签名嘛
1、openssl genrsa -des3 -out root.key 1024
生成 CA 的自签证书
2、openssl req -new -x509 -key root.key -out root.crt -days 365 -config "c:\usr\local\ssl\openssl2.cnf"
同样的道理生成服务器端私钥
3、openssl genrsa -des3 -out server.key 1024
生成服务器端签名请求文件
4、openssl req -new -key server.key -out server.csr -config "c:\usr\local\ssl\openssl2.cnf"
利用 CA 进行签名证书
5、openssl ca -in server.csr -out server.crt -keyfile root.key -cert root.crt -days 365 -config "c:\usr\local\ssl\openssl2.cnf"
常用格式转换
a,得到 pfx 格式的私钥
openssl pkcs12 -export -out server.pfx -inkey server.key -in server.crt
b,从pfx文件中分离出 cer 格式的公钥
openssl x509 -inform pem -in server.crt -outform der -out server_public.cer
关注+转发
SpringBoot2 整合 OAuth2 资源认证(保护)
猜你喜欢
- 2025-07-10 对称加密vs非对称加密(对称加密vs非对称加密)
- 2025-07-10 对称加密 vs 非对称加密(对称加密与非对称加密有何区别)
- 2025-07-10 聊聊对称加密与非对称加密(对称加密与非对称加密结合使用)
- 2025-07-10 什么是非对称加密算法?(非对称加密概念)
- 2025-07-10 深入浅出:区块链技术中的非对称加密算法--签名和加密
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- java反编译工具 (77)
- java反射 (57)
- java接口 (61)
- java随机数 (63)
- java7下载 (59)
- java数据结构 (61)
- java 三目运算符 (65)
- java对象转map (63)
- Java继承 (69)
- java字符串替换 (60)
- 快速排序java (59)
- java并发编程 (58)
- java api文档 (60)
- centos安装java (57)
- java调用webservice接口 (61)
- java深拷贝 (61)
- 工厂模式java (59)
- java代理模式 (59)
- java.lang (57)
- java连接mysql数据库 (67)
- java重载 (68)
- java 循环语句 (66)
- java反序列化 (58)
- java时间函数 (60)
- java是值传递还是引用传递 (62)
本文暂时没有评论,来添加一个吧(●'◡'●)