Skip to content

Instantly share code, notes, and snippets.

@yonat
Created July 11, 2023 08:25
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 yonat/56495c07d3c76a320d9be0721682daf3 to your computer and use it in GitHub Desktop.
Save yonat/56495c07d3c76a320d9be0721682daf3 to your computer and use it in GitHub Desktop.
Generate push certificate using fast lane, and create additional p12 for use in the Keychain Access app
# Generate push certificates.
# Usage: generate_push_certificate <app-bundle-id> <user-email> <cert-password>
generate_push_certificate() {
app=$1
user=$2
password=$3
fastlane pem -a "$app" -u "$user" -p "$password"
convert_push_certificate_to_keychain_format "production_${app}_ios.p12" "$password"
}
# Convert p12 to Keychain acceptable format.
# Usage: convert_push_certificate_to_keychain_format <cert-file.p12> <cert-password>
convert_push_certificate_to_keychain_format() {
cert=$1
password=$2
/opt/homebrew/opt/openssl@1.1/bin/openssl pkcs12 -in "$cert" -out temp.pem -passin pass:"$password" -passout pass:"$password"
/opt/homebrew/opt/openssl@1.1/bin/openssl pkcs12 -export -in temp.pem -out "keychain_$cert" -passin pass:"$password" -passout pass:"$password"
rm temp.pem
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment