4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

APNSの証明書を作成するスクリプト

Last updated at Posted at 2013-11-18

同じような記事がいくつかありますが、自分の環境では動かなかったので、自分の環境で動くものを公開します。
第一引数に.certファイルを、第二引数に.p12ファイルを指定してください。
第三引数に証明書を区別するためのサフィックスの文字列を入力してください。「aps_ck_<サフィックス>.pem」という名前で出力されます。

#!/bin/zsh

if [[ $# -ne 3 ]]; then
    echo "ArgumentError: wrong number of arguments ($# for 3)"
    echo 'arg1={certificate file name(.cer)}, arg2={key file name(.p12)}, arg3=suffix of filename.'
    exit 1
fi

openssl x509 -in $1 -inform der -out aps_cert.pem
openssl pkcs12 -nocerts -out aps_key.pem -in $2
cat aps_cert.pem aps_key.pem > aps_ck_$3.pem
rm aps_cert.pem
rm aps_key.pem
4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?