Skip to content

acme convert —— 转换证书格式 ​

在本机转换证书文件格式,支持 pem / der / pfx / jks。输入可以是 CertiMan 托管的 ACME 证书(-d / -c),也可以是任意本地证书文件(位置参数)。该命令不请求 CA。

用法 ​

bash
certiman acme convert [cert-file] [flags]

参数 ​

输入(两种方式互斥):

参数 / flag类型说明
cert-file(位置参数)string源证书文件路径;与 -d / -c 互斥
--domain / -d[]string选择器:按主域名指定托管证书
--conf / -cstring选择器:证书配置文件路径
--fromstring源格式:pem / pfx / jks;省略时按源文件扩展名推断
--private-keystring配套私钥路径;仅在源文件不含私钥时需要

输出:

flag类型默认说明
--tostring目标格式:pem / der / pfx / jks,必填
--out-filestring单产物输出路径;与 --out-dir 互斥,两者必须提供其一
--out-dirstring多产物输出目录;转换产生多个文件时必须使用本项
--password-filestring源密钥库(PFX / JKS)的口令文件
--target-password-filestring目标密钥库(PFX / JKS)的口令文件;TTY 下未提供时交互询问,非交互环境缺少口令时报错
--jks-aliasstringJKS 别名
--pfx-encodingstringmodernPFX 编码:modern / legacy

目标文件已存在时拒绝覆盖,提供 -f 强制覆盖。包含私钥的产物权限为 0600,其余为 0644。

示例 ​

bash
# 将托管证书导出为 PFX
certiman acme convert -d example.com --to pfx \
  --target-password-file /etc/certiman/pfx-password.txt \
  --out-file ./example.com.pfx

# 将本地 PEM 证书与私钥打包为 PFX
certiman acme convert ./fullchain.pem --private-key ./privkey.pem \
  --to pfx --target-password-file ./password.txt --out-file ./server.pfx

# 将 PFX 解包为 PEM(口令从文件读取)
certiman acme convert ./server.pfx --from pfx \
  --password-file ./password.txt --to pem --out-dir ./pem-out

# 覆盖已有产物
certiman acme convert -d example.com --to der --out-file ./example.com.der -f

输出 ​

0成功(示例)
text
✔ 已写入 /etc/nginx/ssl/example.com.pfx
项目      内容
目标格式  pfx
产物      /etc/nginx/ssl/example.com.pfx

相关命令 ​

  • acme issue —— 申请时通过 --output.formats 自动生成其它格式
  • acme status —— 查看证书的转换记录