IBM Cloud Docs
為何無法匯入我的憑證檔?

為何無法匯入我的憑證檔?

您嘗試使用 IBM Cloud® Secrets Manager 來匯入 SSL/TLS 憑證,但無法完成動作。

您具有要儲存在 Secrets Manager中的未過期 TLS 憑證。 當您嘗試使用 Secrets Manager 使用者介面匯入檔案時,收到下列錯誤:

Add secret failed
An error occurred and the secret couldn't be added.

您也嘗試使用 Secrets Manager API 來匯入檔案,但收到下列錯誤:

Unable to parse the certificate

Secrets Manager 僅支援 .pem 格式的 X.509 憑證檔案。 不過,您可能正在使用不同檔案格式的憑證。 例如, X.509 憑證可以具有各種副檔名類型,包括:

  • 憑證 (.crt) 或 (.cer)
  • 識別編碼規則 (.der)
  • 加強隱私保護的電子郵件 (.pem)

若要解決此問題,請確定您的憑證檔採用支援的格式,然後再將它匯入至 Secrets Manager。

  1. 使用 openssl 公用程式,將 X.509 憑證轉換為 .pem 格式。

    若要將 .crt 檔案轉換為 .pem,請執行下列指令:

    openssl x509 -in cert.crt -out cert.pem
    

    若要將 .cer 檔案轉換為 .pem,請執行下列指令:

    openssl x509 -in cert.cer -out cert.pem
    

    若要將 .der 檔案轉換為 .pem,請執行下列指令:

    openssl x509 -in cert.der -out cert.pem
    
  2. 選用項目: 如果您使用 Secrets Manager API 來匯入憑證,請確保資料格式正確。

    您可以使用下列 UNIX 指令,將 .pem 檔案格式化為可傳遞至 Secrets Manager API 的單行字串:

    awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' cert.pem