OpenSSL 製作證書時出現的錯誤的解決辦法

2021-09-25 10:04:36 字數 2196 閱讀 1797

在製作證書的過程中遇到的問題及解決辦法:

出現:i am unable to access the ./democa/newcerts directory

./democa/newcerts:nosuch file or directory

解決:修改openssl.cnf

在42行:dir = ./democa修改為 dir = ./

出現:failed to update database

txt_db error number 2

解決:修改index.txt.attr

將unique_subject = yes修改為 unique_subject = no

附上詳細製作過程:

//把openssl安裝目錄下的misc拷貝到使用者目錄下

cdmkdir sslca

cd sslca

sudo cp /usr/local/ssl/ssl/misc -r ./

sudo cp /usr/local/ssl/ssl/openssl.cnf ./misc

cd misc

ca.sh –newca

//產生乙個democa資料夾

cd democa

//複製安裝目錄下面的openssl.cnf檔案到democa下

sudo cp /usr/local/ssl/ssl/openssl.cnf ./

//產生ca自簽名證書

openssl genrsa -out ./private/ca.key -rand ./private/.rnd -des 2048

openssl req -new -x509 -days 3650 -key ./private/ca.key -out ./private/ca.crt -config openssl.cnf

openssl x509 -in ./private/ca.crt -noout -text

//產生server的證書過程

openssl genrsa -out ./private/server.key 1024

openssl req -new -key ./private/server.key -out ./newcerts/server.csr -config openssl.cnf

//這一步如果產生錯誤,請看後面的解決方法

openssl ca -in ./newcerts/server.csr -cert ./private/ca.crt -keyfile ./private/ca.key -config openssl.cnf -policy policy_anything -out ./certs/server.crt

openssl x509 -in ./certs/server.crt -noout -text

//產生proxy的證書過程

openssl genrsa -out ./private/proxy.key 1024

//這步要是產生錯誤,請看後面的解決方法

openssl req -new -key ./private/proxy.key -out ./newcerts/proxy.csr -config openssl.cnf

openssl ca -in ./newcerts/proxy.csr -cert ./private/ca.crt -keyfile./private/ca.key -config openssl.cnf -policy policy_anything -out ./certs/proxy.crt

openssl x509 -in ./certs/proxy.crt -noout -text

//產生client的證書過程

openssl genrsa -out ./private/client.key 1024

openssl req -new -key ./private/client.key -out ./newcerts/client.csr -config openssl.cnf

openssl ca -in ./newcerts/client.csr -cert ./private/ca.crt -keyfile ./private/ca.key -config openssl.cnf -policy policy_anything -out ./certs/client.crt

openssl x509 -in ./certs/client.crt -noout -text

利用openssl 庫製作證書以及驗證

rsa證書 ca證書 openssl genrsa out cakey.key 1024 2048 這個命令會生成乙個1024 2048位的金鑰。openssl req new x509 key cakey.key out cacert.pem days 1234 這個命令將用上面生成的金鑰cake...

使用openssl製作證書和進行CMS格式數字簽名

openssl中有如下字尾名的檔案 key格式 私有的金鑰 csr格式 證書簽名請求 證書請求檔案 含有公鑰資訊,certificate signing request的縮寫 crt格式 證書檔案,certificate的縮寫 crl格式 證書吊銷列表,certificate revocation ...

用Openssl API製作證書

二 產生請求證書。在openssl中,本部分由req.c實現,不過它實在過於複雜不太利於理解。證書請求包括3個部分 證書請求資訊,乙個簽名演算法識別符號和乙個對證書請求資訊的數字簽名。證書的請求資訊包括實體的別名 實體的公鑰和一系列有關實體的其他資訊的屬性。構造乙個證書請求包含如下幾個步驟 1,構造...