Skip to content

Instantly share code, notes, and snippets.

@jcharlier
Created March 22, 2018 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcharlier/54dd9ce288ad4f486ac57e3359410aa7 to your computer and use it in GitHub Desktop.
Save jcharlier/54dd9ce288ad4f486ac57e3359410aa7 to your computer and use it in GitHub Desktop.
Apple Pay Merchant Certificate process
#!/bin/bash
dir="apple-certificates-data"
if [ -d $dir ]; then
echo "**Este script sobrescreve os dados que estão no diretorio '$dir'!**"
read -r -p "Continuar? [y/N] " start
start=${start,,} # tolower
if [[ ! "$start" =~ ^(yes|y)$ ]]; then
exit 0
fi
fi
mkdir -p $dir
cd $dir
openssl req -new -sha256 -newkey rsa:2048 -nodes -out cert-request.csr -subj '/O=Mobly/C=BR'
xdg-open https://developer.apple.com/account/ios/identifier/merchant 2>/dev/null &
nautilus $(pwd) 2>/dev/null &
echo "#1 - Vá para https://developer.apple.com/account/ios/identifier/merchant"
echo "#2 - Selecione o merchant ID e em 'Merchant Identity Certificate' clique em 'Create Certificate'->Continue"
echo "#3 - Suba o cert-request.csr localizado dentro da pasta apple-certificate-data"
echo "#4 - Baixe o merchant_id.cer e salve-o em "$(pwd)"/merchant_id.cer"
read -r -p "Continuar? [y/N] " response
response=${response,,} # tolower
if [[ "$response" =~ ^(yes|y)$ ]]; then
if [ ! -f $(pwd)"/merchant_id.cer" ];then
echo "kd o filé? era para estar em "$(pwd)"/merchant_id.cer"
exit
fi
openssl x509 -inform der -in merchant_id.cer -out merchant_id.pem
openssl rsa -in privkey.pem -pubout -out pubkey.pem
cat merchant_id.pem pubkey.pem > apple-pay-certificate.pem
cp privkey.pem apple-pay-key.pem
echo "Os arquivos para subir no bob são:"
echo "Apple Pay Certificate: $(pwd)/apple-pay-certificate.pem"
echo "Apple Pay Key: $(pwd)/apple-pay-key.pem"
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment