證書要錢還貴,但金融系統報文必需要進行安全傳輸,怎麼辦,本身生成證書吧,這篇博客記錄的背景是: 生成一對 RSA 鑰匙,公鑰採用 X。509 進行加密,私鑰採用 PKCS8 進行加密, 字節長度爲1024數據庫
OpenSSL安裝包安全
Windows7 64Bit加密
1,下載並安裝OpenSSL,設置環境變量code
OPENSSL_HOME = D:\MySoftware\OpenSSL-Win64 Path = Path + ; + % + OPENSSL_HOME + % + \bin + ;
2,建立一個你將用來建立證書的目錄,例如個人是 F:\Testorm
3,文件和目錄補齊(若是不補齊在自簽證書時會報找不到文件的錯)server
index.txt OpenSSL在建立自簽證書時會向該文件裏寫下索引 database.txt OpenSSL會模擬數據庫將一些敏感信息寫在該文件裏 erial.txt 建立該文件後,請編輯在第一行寫下 01 certs 文件夾,目前沒什麼用,僅僅只是我配置文件這樣寫 注意: 這裏提到的全部文件必須補齊,而且文件名不得更改 !
4,生成證書排序
openssl genrsa -des3 -out root.key 1024 openssl req -new -key root.key -out root.csr openssl req -new -x509 -key root.csr -out root.crt -days 365 -config ../openssl.conf openssl req -new -x509 -key root.key -out root.crt -days 365 -config ../openssl.conf openssl genrsa -out server.key 1024 openssl req -new -key server.key -out server.csr -config openssl.conf openssl ca -in server.csr -out server.crt -keyfile root.key -cert root.crt -days 365 -config openssl.conf
5,經常使用格式轉換索引
openssl pkcs12 -export -out server.pfx -inkey server.key -in server.crt openssl x509 -inform pem -in server.crt -outform der -out server_public.cer