惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
T
Threat Research - Cisco Blogs
小众软件
小众软件
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Tailwind CSS Blog
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
博客园 - 【当耐特】
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
The Last Watchdog
The Last Watchdog
Simon Willison's Weblog
Simon Willison's Weblog
T
Threatpost
S
Secure Thoughts
O
OpenAI News
P
Proofpoint News Feed
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
宝玉的分享
宝玉的分享
Scott Helme
Scott Helme
T
Tenable Blog
A
Arctic Wolf
L
LINUX DO - 热门话题
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
博客园 - Franky
WordPress大学
WordPress大学
Know Your Adversary
Know Your Adversary
博客园_首页
雷峰网
雷峰网
IT之家
IT之家
PCI Perspectives
PCI Perspectives
L
LINUX DO - 最新话题
H
Heimdal Security Blog

博客园 - 黄尚

年前辞职,年后找工作 airport 抓包 配置ssh使用socks代理 配置git使用socks5代理 bash 相关的一些小代码片断 MacOS changed System Integrity Protection status CMakeLists.txt for nginx 构建最小的docker容器 centos 7 挂载大硬盘 rsync 通过 ssh 上传文件 php-fpm 在centos 7下的安装配置 在osx下通过vmware无GUI方式运行centos 7 ruby on rails 在centos 7下的安装配置 Mariadb 在centos 7下的安装配置 PostgreSQL 在centos 7下的安装配置 osx 编译安装配置 ruby on rails nginx相关的一些记录 用systemd脚本自动启动node js程序 SSH Tunneling
tls/ssl证书生成和格式转换
黄尚 · 2015-05-01 · via 博客园 - 黄尚

生成密钥:
openssl genrsa -out privkey.pem 2048

生成csr申请文件:
openssl req -sha256 -new -key privkey.pem -out pubkey.pem

生成自签名证书:
openssl x509 -req -days 365 -in my.csr -signkey my.key -out my.crt

转换为pfx格式:
openssl pkcs12 -export -out my.pfx -inkey my.key -in my.pem

PKCS7 转 PEM:

openssl pkcs7 -print_certs -in my.cer -out my.pem

JKS  转 PKCS12:

keytool -importkeystore -srckeystore my.jks -destkeystore my.p12 -srcstoretype JKS -deststoretype PKCS12 -srcstorepass passwordText -deststorepass passwordText -srcalias aliasText -destalias aliasText -srckeypass passwordText -destkeypass passwordText -noprompt

PKCS12 转 PEM:

openssl pkcs12 -in my.p12 -out my.pem -passin pass:password_of_p12 -passout pass:password_for_pem

PEM 转 DER:

openssl x509 -outform der -in my.pem -out my.der

PEM 转 P7B:

openssl crl2pkcs7 -nocrl -certfile my.pem -out my.p7b -certfile ca.pem

去掉private key密码:

openssl rsa -in my_encrypt.key -out my.key

申请免费证书:
https://www.letsencrypt.com

转换为tomcat所用证书格式:

openssl pkcs12 -export -in my.crt -inkey my.key -out my.pk12 -name sshkey

keytool -importkeystore -deststorepass 123455 -destkeypass 123455 -destkeystore my.keystore -srckeystore my.pk12 -srcstoretype PKCS12 -srcstorepass 123455 -alias sshkey

openssl pkcs12 -export -in my.crt -inkey my.key -certfile bundle.crt -out my.p12 -name sshkey

keytool -importkeystore -srckeystore my.p12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore my.jks -alias sshkey

列出jks的详细信息:

keytool -list -v -keystore my.jks 

检查证书文件是否匹配:

openssl x509 -noout -modulus -in my.crt | openssl md5
openssl rsa -noout -modulus -in my.key | openssl md5
openssl req -noout -modulus -in my.csr | openssl md5

检查证书链是否匹配:

openssl verify -CAfile bundle.crt my.crt

tomcat 配置:

<Connector port="8443" protocol="HTTP/1.1"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="/usr/share/tomcat/ssl/my.keystore"
keystorePass="123455"
SSLVerifyClient="optional" SSLProtocol="TLSv1+TLSv1.1+TLSv1.2"
ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_3DES_EDE_CBC_SHA" />