以下部分僅供參考,咱們不用。^-^
生成SSL證書的語句:1.私密KEY openssl genrsa -des3 -out hm_org.key 2048 需要輸入密碼2.證書 openssl req -new -key hm_org.key -out hm.req 需要輸入你的相關資料。如下:Country Name (2 letter code) [XX]:cnState or Province Name (full name) []:yunnanLocality Name (eg, city) [Default City]:kunmingOrganization Name (eg, company) [Default Company Ltd]:hmailserver.org Co., Ltd.Organizational Unit Name (eg, section) []:eggCommon Name (eg, your name or your server's hostname) []:(填域名)Email Address []: (你的郵件,不用翻譯了吧)please enter the following ”extra" attributesto be sent with your certificate requesta challenge password : (這里的挑戰密碼是指:“挑戰密碼”請求作為CSR生成的一部分,用于將保密密鑰加密的密碼(在請求的密鑰生成的時間時,或當一個明文密鑰加密后 - 然后每次再次請求啟用了SSL的服務使用它啟動時),是兩個單獨的和不同的事情。)你看著辦。An optional company name []: 這里是公司名。3. 自簽證書 openssl x509 -req -days 3650 -sha1 -extfile C:\OpenSSL\bin\openssl.cfg -extensions v3_ca -signkey hm_org.key -in hm.req -out hm.crt4.通俗的講,去除key的密碼 openssl rsa -in hm_org.key -out hm.key生成私匙openssl genrsa -out key.pem 2048生成證書申請文件openssl req -new -key key.pem -out ca-req.csr生成證書 有效期10年openssl x509 -req -days 3650 -in ca-req.csr -signkey key.pem -out certificate.crtMicrosoft Windows [版本 6.3.9600](c) 2013 Microsoft Corporation。保留所有權利。生成私匙C:\OpenSSL-Win64\bin>openssl genrsa -des3 -out server.key 1024Generating RSA private key, 1024 bit long modulus (2 primes)........................+++++..................+++++e is 65537 (0x010001)Enter pass phrase for server.key:因為用了des3參數,所以需要錄入兩次密碼Verifying - Enter pass phrase for server.key:生成證書申請文件C:\OpenSSL-Win64\bin>openssl req -new -out ca-req.csr -key server.keyEnter pass phrase for server.key:You are about to be asked to enter information that will be incorporatedinto 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 blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:cnState or Province Name (full name) [Some-State]:hebeiLocality Name (eg, city) []:shijiazhuangOrganization Name (eg, company) [Internet Widgits Pty Ltd]:fengbaokejiOrganizational Unit Name (eg, section) []:mgrCommon Name (e.g. server FQDN or YOUR name) []:khzEmail Address []:khzide@163.comPlease enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:.An optional company name []:.生成根證書 有效期10年C:\OpenSSL-Win64\bin>openssl x509 -req -days 3650 -sha1 -extensions v3_ca -signkey server.key -in ca-req.csr -out root_ca.crtSignature oksubject=C = cn, ST = hebei, L = shijiazhuang, O = fengbaokeji, OU = mgr, CN = khz, emailAddress = khzide@163.comGetting Private keyEnter pass phrase for server.key:SSL--Windows下生成OpenSSL自簽證書:OPenSSL下載地址:https://www.openssl.org/source/編譯好的OpenSSL下載地址:?http://slproweb.com/products/Win32OpenSSL.html此文下載的是64位的:Win64OpenSSL_Light-1_1_0b.exe安裝openssl到E盤,路徑為:E:\openssl打開cmd.exe, cd到E:\openssl\bin下面:首先,生成服務器端的私鑰(key文件):openssl?genrsa?-des3?-out?server.key?1024輸入密碼:在些輸入的密碼為:123456請求建立證書的申請文件root.csr:輸入國家,省份,城市,公司信息,證書發送郵箱地址和證書密碼(服務器端):創立一個為期10年的根證書root.crt輸入的密碼為:123456建立服務器證書秘鑰:密碼:123456創立服務器證書申請文件,密碼仍為123456:輸入國家,省份,城市,公司信息,證書發送郵箱地址和證書密碼:創立為期兩年的服務器證書server.crt, 密碼為123456:查看是否建立成功:路徑到E:\OpenSSL-Win64\bin目錄下,查看: