Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Batch file to help easily create all the files needed to get apple app/game up and running without using a mac
echo off
cd c:\
cd c:\OpenSSL-Win32\bin
echo.
echo.
echo -----------------App P12 File Generator---------------
echo.
echo This batch file was made to help you easily create all
echo the files you need to get your apple app/game up and
echo running without using a mac.
echo.
echo -[1]- Please refrain from putting the file extension name
echo along with the file name. This is done automatically.
echo.
echo -[2]- The first directory you input will be where the
echo program looks for files it needs and where it places
echo files it creates.
echo.
echo ------------------------------------------------------
echo.
echo.
set /p keyPath=Please Enter path to save to (ex: C:/Users/Name/Desktop/Keys):
echo.
echo.
set /p keyName=Please Enter key name (ex: GameName):
echo.
echo.
echo Final path: "%keyPath%\%keyName%"
echo.
echo.
set /p existingCertificate=Do you have an existing certificate and key [y/n] ?:
if %existingCertificate%==y goto :oldGeneration
if %existingCertificate%==n goto :newGeneration
:newGeneration
openssl genrsa -out "%keyPath%\%KeyName%.key" 2048
echo.
echo.
echo Key hopefully generated...if not try running command prompt in administrative mode
pause
echo.
echo.
set /p email=Please enter in your email:
echo.
echo.
set /p personName=Please enter in your first and last name (ex: First Last):
echo.
echo.
set /p countryCode=Please enter your country code (ex: us):
openssl req -new -key "%keyPath%\%keyName%.key" -out "%keyPath%\%keyName%.certSigningRequest" -subj "/emailAddress=%email%, CN=%personName%, C=%countryCode%"
echo.
echo.
echo Certificate Signing Request file hopefully generated...
echo if not try running command prompt in administrative mode
echo.
echo Use this file to generate a new certificate for development in the apple dev portal
pause
:oldGeneration
echo.
echo.
set /p certFileName=Please enter name of the cert file your using:
openssl x509 -in "%keyPath%\%certFileName%.cer" -inform DER -out "%keyPath%\%keyName%.pem" -outform PEM
echo.
echo.
echo PEM file hopefully generated...if not try running command prompt in administrative mode
pause
openssl pkcs12 -export -inkey "%keyPath%\%keyName%.key" -in "%keyPath%\%keyName%.pem" -out "%keyPath%\%keyName%.p12"
echo.
echo.
echo P12 file hopefully generated...if not try running command prompt in administrative mode
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.