Making a cert for Casper and Apple’s GSX

# DigiCert-generated code from https://www.digicert.com/easy-csr/keytool.htm

keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore Applecare-APP157-0008675309_Test_apple_com.jks -dname "CN=Applecare-APP157-0008675309.Test.apple.com,OU=Rock, O=Tommy Tutone, L=Hollywood, ST=CA, C=US" && keytool -certreq -alias server -file Applecare-APP157-0008675309_Test_apple_com.csr -keystore Applecare-APP157-0008675309_Test_apple_com.jks && echo Your certificate signing request is in Applecare-APP157-0008675309_Test_apple_com.csr.  Your keystore file is Applecare-APP157-0008675309_Test_apple_com.jks.  Thanks for using the DigiCert keytool CSR helper.

# Verify the .CSR

openssl req -in Applecare-APP157-0008675309_Test_apple_com.csr -noout -text

# Convert the Java Keytool-generated .JKS to a .P12
# See: http://stackoverflow.com/questions/652916/converting-a-java-keystore-into-pem-format

keytool -importkeystore -srckeystore Applecare-APP157-0008675309_Test_apple_com.jks -destkeystore Applecare-APP157-0008675309_Test_apple_com.p12 -srcstoretype jks -deststoretype pkcs12

# Convert the .P12 to a .PEM private key

openssl pkcs12 -in Applecare-APP157-0008675309_Test_apple_com.p12 -out Applecare-APP157-0008675309_Test_apple_com.pem

#Or you can use OpenSSL
#The command line openssl application can be used to generate the public/private key pair and certificate signed request (CSR).

openssl genrsa -aes256 -out privatekey.pem 2048

When running this command, you will be prompted to enter the pass phrase for the private key. This is your secure pass phrase and should not be shared with anyone.
-This pass phrase can be anything like a password

#CSR Generation

openssl req -new -sha256 -key privatekey.pem -out certreq.csr

Once you enter the command , please follow the instructions on the prompt and enter the details being requested.

# Combine the private key and Apple-supplied certificate

openssl pkcs12 -export -inkey Applecare-APP157-0008675309_Test_apple_com.pem -in Applecare-APP157-0008675309.Test.apple.com.cert.pem -out gsx_test.p12