[svc]證書各個字段的含義
阿新 • • 發佈:2017-12-22
host alc img 第一步 圖片 can 服務器 quest mar
證書生成工具
- 1,openssl
- 2,jdk自帶的keystone
- 3,cfssl
證書中各個字段的含義
數字證書中主題(Subject)中字段的含義 一般的數字證書產品的主題通常含有如下字段: 公用名稱 (Common Name) 簡稱:CN 字段,對於 SSL 證書,一般為網站域名;而對於代碼簽名證書則為申請單位名稱;而對於客戶端證書則為證書申請者的姓名; 單位名稱 (Organization Name) :簡稱:O 字段,對於 SSL 證書,一般為網站域名;而對於代碼簽名證書則為申請單位名稱;而對於客戶端單位證書則為證書申請者所在單位名稱; 證書申請單位所在地: 所在城市 (Locality) 簡稱:L 字段 所在省份 (State/Provice) 簡稱:S 字段 所在國家 (Country) 簡稱:C 字段,只能是國家字母縮寫,如中國:CN 其他一些字段: 電子郵件 (Email) 簡稱:E 字段 多個姓名字段 簡稱:G 字段 介紹:Description 字段 電話號碼:Phone 字段,格式要求 + 國家區號 城市區號 電話號碼,如: +86 732 88888888 地址:STREET 字段 郵政編碼:PostalCode 字段 顯示其他內容 簡稱:OU 字段
HTTPS證書生成原理和部署細節
使用rsa一鍵生成: openssl req -x509 -days 3650 -nodes -newkey rsa:2048 -keyout java-demo.key -out java-demo.crt 國家 省份 城市 公司 部門 名字 [root@test52 registry]# openssl req -x509 -days 3650 -nodes -newkey rsa:2048 -keyout docker-registry.key -out docker-registry.crt Generating a 2048 bit RSA private key ............................................+++ .....................................................................................................................................................................................+++ writing new private key to 'docker-registry.key' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:CN State or Province Name (full name) []:Locality Name (eg, city) [Default City]:guangdong Organization Name (eg, company) [Default Company Ltd]:pp100 Organizational Unit Name (eg, section) []:it Common Name (eg, your name or your server's hostname) []:www.maotai.com Email Address []:[email protected]
第一步,為服務器端和客戶端準備公鑰、私鑰:
# 生成服務器端私鑰
openssl genrsa -out server.key 1024
# 生成服務器端公鑰
openssl rsa -in server.key -pubout -out server.pem
# 生成客戶端私鑰
openssl genrsa -out client.key 1024
# 生成客戶端公鑰
openssl rsa -in client.key -pubout -out client.pem
第二步,生成 CA 證書:
# 生成 CA 私鑰 openssl genrsa -out ca.key 1024 # X.509 Certificate Signing Request (CSR) Management. openssl req -new -key ca.key -out ca.csr # X.509 Certificate Data Management. openssl x509 -req -in ca.csr -signkey ca.key -out ca.crt
第三步,生成服務器端證書和客戶端證書:
# 服務器端需要向 CA 機構申請簽名證書,在申請簽名證書之前依然是創建自己的 CSR 文件
openssl req -new -key server.key -out server.csr
# 向自己的 CA 機構申請證書,簽名過程需要 CA 的證書和私鑰參與,最終頒發一個帶有 CA 簽名的證書
openssl x509 -req -CA ca.crt -CAkey ca.key -CAcreateserial -in server.csr -out server.crt
# client 端
openssl req -new -key client.key -out client.csr
# client 端到 CA 簽名
openssl x509 -req -CA ca.crt -CAkey ca.key -CAcreateserial -in client.csr -out client.crt
[svc]證書各個字段的含義