如何从 apple api json 创建 .cer

How to create .cer from apple api json

我需要为所有 apple 操作自动设置:

响应示例:([GET] https://api.appstoreconnect.apple.com/v1/certificates/{id} )

  "data": {
    "type": "certificates",
    "id": "cert id xxxx",
    "attributes": {
      "serialNumber": "xxxxx",
      "certificateContent": "cer content...",
      "displayName": "xxx",
      "name": "iOS Distribution: xxx",
      "csrContent": null,
      "platform": "IOS",
      "expirationDate": "2020-09-03T20:03:52.000+0000",
      "certificateType": "IOS_DISTRIBUTION"
    },
    "links": {
      "self": "https://api.appstoreconnect.apple.com/v1/certificates/xxx"
    }
  },
  "links": {
    "self": "https://api.appstoreconnect.apple.com/v1/certificates/xxx"
  }
}

Apple 说你可以用这个 api 下载,我研究了如何从这个数据创建 .cer,所以我不能。

注意:解码"certificateContent"可以看到公司信息

总结:我需要从这个响应创建 cer 并添加到钥匙串 这个命令:security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ios_distribution.cer

已解决:base64 --decode certificateContent.txt > certificate.cer