Ⅰ java X509Certificate 根證書驗證
根證書導入庫,用keytool命令驗證就方便了
Ⅱ 受信任憑據ca證書怎樣刪
手機型號:小米5X
1、在桌面上找到設置,點擊設置。
Ⅲ 如何生成CA證書
如何生成CA證書
一般情況下,如果能找到可用的證書,就可以直接使用,只不過會因證書的某些信息不正確或與部署證書的主機不匹配而導致瀏覽器提示證書無效,但這並不影響使用。
需要手工生成證書的情況有:
找不到可用的證書
需要配置雙向SSL,但缺少客戶端證書
需要對證書作特別的定製
首先,無論是在Linux下還是在Windows下的Cygwin中,進行下面的操作前都須確認已安裝OpenSSL軟體包。
1. 創建根證書密鑰文件(自己做CA)root.key:
openssl genrsa -des3 -out root.key
輸出內容為:
[lenin@archer ~]$ openssl genrsa -des3 -out root.key
Generating RSA private key, 512 bit long molus
……………..++++++++++++
..++++++++++++
e is 65537 (0×10001)
Enter pass phrase for root.key: ← 輸入一個新密碼
Verifying – Enter pass phrase for root.key: ← 重新輸入一遍密碼
2. 創建根證書的申請文件root.csr:
openssl req -new -key root.key -out root.csr
輸出內容為:
[lenin@archer ~]$ openssl req -new -key root.key -out root.csr
Enter pass phrase for root.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) [AU]:CN ← 國家代號,中國輸入CN
State or Province Name (full name) [Some-State]:BeiJing ← 省的全名,拼音
Locality Name (eg, city) []:BeiJing ← 市的全名,拼音
Organization Name (eg, company) [Internet Widgits Pty Ltd]:MyCompany Corp. ← 公司英文名
Organizational Unit Name (eg, section) []: ← 可以不輸入
Common Name (eg, YOUR name) []: ← 此時不輸入
Email Address []:[email protected] ← 電子郵箱,可隨意填
Please enter the following 『extra』 attributes
to be sent with your certificate request
A challenge password []: ← 可以不輸入
An optional company name []: ← 可以不輸入
3. 創建一個自當前日期起為期十年的根證書root.crt:
openssl x509 -req -days 3650 -sha1 -extensions v3_ca -signkey root.key -in root.req -out root.crt
輸出內容為:
[lenin@archer ~]$ openssl x509 -req -days 3650 -sha1 -extensions v3_ca -signkey root.key -in root.csr -out root.crt
Signature ok
subject=/C=CN/ST=BeiJing/L=BeiJing/O=MyCompany Corp./[email protected]
Getting Private key
Enter pass phrase for root.key: ← 輸入前面創建的密碼
4. 創建伺服器證書密鑰server.key:
openssl genrsa –des3 -out server.key 2048
輸出內容為:
[lenin@archer ~]$ openssl genrsa -out server.key 2048
Generating RSA private key, 2048 bit long molus
….+++
…………………………………………..+++
e is 65537 (0×10001)
運行時會提示輸入密碼,此密碼用於加密key文件(參數des3便是指加密演算法,當然也可以選用其他你認為安全的演算法.),以後每當需讀取此文件(通過openssl提供的命令或API)都需輸入口令.如果覺得不方便,也可以去除這個口令,但一定要採取其他的保護措施!
去除key文件口令的命令:
openssl rsa -in server.key -out server.key
5.創建伺服器證書的申請文件server.csr:
openssl req -new -key server.key -out server.csr
輸出內容為:
[lenin@archer ~]$ openssl req -new -key server.key -out server.req
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) [AU]:CN ← 國家名稱,中國輸入CN
State or Province Name (full name) [Some-State]:BeiJing ← 省名,拼音
Locality Name (eg, city) []:BeiJing ← 市名,拼音
Organization Name (eg, company) [Internet Widgits Pty Ltd]:MyCompany Corp. ← 公司英文名
Organizational Unit Name (eg, section) []: ← 可以不輸入
Common Name (eg, YOUR name) []:www.mycompany.com ← 伺服器主機名,若填寫不正確,瀏覽器會報告證書無效,但並不影響使用
Email Address []:[email protected] ← 電子郵箱,可隨便填
Please enter the following 『extra』 attributes
to be sent with your certificate request
A challenge password []: ← 可以不輸入
An optional company name []: ← 可以不輸入
6. 創建自當前日期起有效期為期兩年的伺服器證書server.crt:
openssl x509 -req -days 730 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAserial root.srl -CAcreateserial -in server.csr -out server.crt
輸出內容為:
[lenin@archer ~]$ openssl x509 -req -days 730 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAcreateserial -in server.csr -out server.crt
Signature ok
subject=/C=CN/ST=BeiJing/L=BeiJing/O=MyCompany Corp./CN=www.mycompany.com/[email protected]
Getting CA Private Key
Enter pass phrase for root.key: ← 輸入前面創建的密碼
7. 創建客戶端證書密鑰文件client.key:
openssl genrsa -des3 -out client.key 2048
輸出內容為:
[lenin@archer ~]$ openssl genrsa -des3 -out client.key 2048
Generating RSA private key, 2048 bit long molus
……………………………………………………………………………..+++
……………………………………………………………………………………………………….+++
e is 65537 (0×10001)
Enter pass phrase for client.key: ← 輸入一個新密碼
Verifying – Enter pass phrase for client.key: ← 重新輸入一遍密碼
8. 創建客戶端證書的申請文件client.csr:
openssl req -new -key client.key -out client.csr
輸出內容為:
[lenin@archer ~]$ openssl req -new -key client.key -out client.csr
Enter pass phrase for client.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) [AU]:CN ← 國家名稱,中國輸入CN
State or Province Name (full name) [Some-State]:BeiJing ← 省名稱,拼音
Locality Name (eg, city) []:BeiJing ← 市名稱,拼音
Organization Name (eg, company) [Internet Widgits Pty Ltd]:MyCompany Corp. ← 公司英文名
Organizational Unit Name (eg, section) []: ← 可以不填
Common Name (eg, YOUR name) []:Lenin ← 自己的英文名,可以隨便填
Email Address []:[email protected] ← 電子郵箱,可以隨便填
Please enter the following 『extra』 attributes
to be sent with your certificate request
A challenge password []: ← 可以不填
An optional company name []: ← 可以不填
9. 創建一個自當前日期起有效期為兩年的客戶端證書client.crt:
openssl x509 -req -days 730 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAserial root.srl -CAcreateserial -in client.csr -out client.crt
輸出內容為:
[lenin@archer ~]$ openssl x509 -req -days 730 -sha1 -extensions v3_req -CA root.crt -CAkey root.key -CAcreateserial -in client.csr -out client.crt
Signature ok
subject=/C=CN/ST=BeiJing/L=BeiJing/O=MyCompany Corp./CN=www.mycompany.com/[email protected]
Getting CA Private Key
Enter pass phrase for root.key: ← 輸入上面創建的密碼
10. 將客戶端證書文件client.crt和客戶端證書密鑰文件client.key合並成客戶端證書安裝包client.pfx:
openssl pkcs12 -export -in client.crt -inkey client.key -out client.pfx
輸出內容為:
[lenin@archer ~]$ openssl pkcs12 -export -in client.crt -inkey client.key -out client.pfx
Enter pass phrase for client.key: ← 輸入上面創建的密碼
Enter Export Password: ← 輸入一個新的密碼,用作客戶端證書的保護密碼,在客戶端安裝證書時需要輸入此密碼
Verifying – Enter Export Password: ← 確認密碼
11. 保存生成的文件備用,其中server.crt和server.key是配置單向SSL時需要使用的證書文件,client.crt是配置雙向SSL時需要使用的證書文件,client.pfx是配置雙向SSL時需要客戶端安裝的證書文件
.crt文件和.key可以合到一個文件裡面,把2個文件合成了一個.pem文件(直接拷貝過去就行了)
參考:http://sinolog.it/?p=1460
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
http://blog.sina.com.cn/s/blog_4fd50c390101891c.html
x509證書一般會用到三類文,key,csr,crt。
Key是私用密鑰openssl格,通常是rsa演算法。
Csr是證書請求文件,用於申請證書。在製作csr文件的時,必須使用自己的私鑰來簽署申,還可以設定一個密鑰。
crt是CA認證後的證書文,(windows下面的,其實是crt),簽署人用自己的key給你簽署的憑證。
1.key的生成
opensslgenrsa -des3 -out server.key 2048
這樣是生成rsa私鑰,des3演算法,openssl格式,2048位強度。server.key是密鑰文件名。為了生成這樣的密鑰,需要一個至少四位的密碼。可以通過以下方法生成沒有密碼的key:
opensslrsa -in server.key -out server.key
server.key就是沒有密碼的版本了。
2.生成CA的crt
opensslreq -new -x509 -key server.key -out ca.crt -days3650
生成的ca.crt文件是用來簽署下面的server.csr文件。
3.csr的生成方法
opensslreq -new -key server.key -outserver.csr
需要依次輸入國家,地區,組織,email。最重要的是有一個common name,可以寫你的名字或者域名。如果為了https申請,這個必須和域名吻合,否則會引發瀏覽器警報。生成的csr文件交給CA簽名後形成服務端自己的證書。
4.crt生成方法
CSR文件必須有CA的簽名才可形成證書,可將此文件發送到verisign等地方由它驗證,要交一大筆錢,何不自己做CA呢。
opensslx509 -req -days 3650 -in server.csr -CA ca.crt -CAkey server.key-CAcreateserial -out server.crt
輸入key的密鑰後,完成證書生成。-CA選項指明用於被簽名的csr證書,-CAkey選項指明用於簽名的密鑰,-CAserial指明序列號文件,而-CAcreateserial指明文件不存在時自動生成。
最後生成了私用密鑰:server.key和自己認證的SSL證書:server.crt
證書合並:
catserver.key server.crt > server.pem
Ⅳ 怎麼用certutil這個命令吧證書導入到受信任的根證書辦法機構
舉例,我把證書加到 Trusted root 里去。
certutil -addstore root certroot.cer
Ⅳ 為什麼什麼每次開機都會提示你必須安裝根證書,否則無法正常使用!
有時,系統就是這樣的!不過,不影響你使用K寶,不會導致你的內K寶出任何問題!
如果你容想絕對性安全,則建議你關機後再拔出K寶!
至於開機自動彈出,以下兩種方法可以較好的避免:
一、選擇「開始」菜單中的「運行」輸入「msconfig」,確認後,在彈出的窗口選擇「啟動」把「農行K寶」相關的字眼的勾去除,就OK了
二、修改注冊表,選擇「開始」菜單中的「運行……」命令,在打開的「運行」對話框的文本框中輸入「REGEDIT」並按「確定」命令按鈕,然後再選擇「HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Run」後刪除右邊與「農行K寶」有關的內容,此步操作存在一定的危險性,請小心!最好在操作前備份一份注冊表文件。
Ⅵ 關於CA證書伺服器如何將密碼寫到命令行裡面而不需要手動添加的辦法
直接調用system函數啊,我正好也在做證書,不過用的是openssl
Ⅶ 如何使用OpenSSL工具生成根證書與應用證書
使用OpenSSL工具生成根證書與應用證書方法:
1、生成頂級CA的公鑰證書和私鑰文件,有效期10年(RSA 1024bits,默認) openssl req -new -x509 -days 3650 -keyout CARoot1024.key -out CARoot1024.crt
2、 為頂級CA的私鑰文件去除保護口令 openssl rsa -in CARoot1024.key -out CARoot1024.key
3、 生成頂級CA的公鑰證書和私鑰文件,有效期15年(RSA 2048bits,指定) openssl req -newkey rsa:2048 -x509 -days 5480 -keyout CARoot2048.key -out CARoot2048.crt
4、 為頂級CA的私鑰文件去除保護口令 openssl rsa -in CARoot2048.key -out CARoot2048.key
5、 為應用證書/中級證書生成私鑰文件 openssl genrsa -out app.key 2048
6、 根據私鑰文件,為應用證書/中級證書生成 csr 文件(證書請求文件) openssl req -new -key app.key -out app.csr
7、 使用CA的公私鑰文件給 csr 文件簽名,生成應用證書,有效期5年 openssl ca -in app.csr -out app.crt -cert CARoot1024.crt -keyfile CARoot1024.key -days 1826 -policy policy_anything
8、 使用CA的公私鑰文件給 csr 文件簽名,生成中級證書,有效期5年 openssl ca -extensions v3_ca -in app.csr -out app.crt -cert CARoot1024.crt -keyfile CARoot1024.key -days 1826 -policy policy_anything
以上是生成根證書與應用證書過程中要用到的所有命令,根據生成目標不同,分為三組。其中,前面兩組都用於生成自簽名的頂級CA(區別只在於密鑰長度不同),實際應用中只需根據需求選擇一組即可。 最後一組用於生成非自簽名的證書,包括中級證書與應用證書。所謂中級證書,是具有繼續頒發下級證書許可權的子CA,而本文中所說的應用證書,特指不能用來繼續頒發下級證書,只能用來證明個體身份的證書。頂級CA在簽發二者的時候,只是多少一個 -extensions v3_ca 選項的區別,這個選項賦予被簽發的證書繼續簽發下級證書的權力。
Ⅷ 怎樣查看自己電腦上安裝的各類證書
1、首先如果是win7系統則抄在運行中輸入certmgr.msc,如果是win10的系統則直接在左下方輸入上面的這個代碼點擊即可進入證書界面。
Ⅸ Linux Centos 怎麼安裝更新根證書實現支持https訪問
其實很簡單就是一個命令:
mozroots --import --ask-remove
或者使用:
sudo update-ca-certificates
Linux Centos 怎麼安裝更新根證專書實現屬支持https訪問