Part 2: Extracting and Converting Keys and Certificates

 Part 2: Extracting and Converting Keys and Certificates


Part 2: Extracting and Converting Keys and Certificates

Step 5: Extract Keys and Certificates Using Openssl

To use your certificates in the MDM server, you need to extract and convert them into the correct formats.

  1. Extract the Private Key:

    bash
    # Extract private key from the p12 file openssl pkcs12 -in private.p12 -nocerts -out key.pem
  2. Remove the Password from the Private Key:

    bash
    # Strip the password from the private key openssl rsa -in key.pem -out private.key
  3. Extract the Certificate:

    bash
    # Extract certificate from the p12 file openssl pkcs12 -in private.p12 -clcerts -nokeys -out cert.pem
  4. Convert the Certificate to DER Format:

    bash
    # Convert the certificate to DER format openssl x509 -in cert.pem -inform PEM -out mdm.cer -outform DER

Step 6: Generate Apple Push Certificate CSR Using Python Script

  1. Prepare the Environment:

    • Clone the required git repository:
      bash
      git submodule init git submodule update
    • Copy private.keypush.csr, and mdm.cer to the /vendor/ directory.
  2. Run the CSR Signing Command:

    bash
    # Use mdm_vendor_sign script to generate applepush.csr python mdm_vendor_sign.py –key private.key –csr push.csr –mdm mdm.cer –out applepush.csr

Step 7: Obtain the Push Certificate from Apple

  1. Access Apple’s Push Certificates Portal:

    • Click Create a Certificate and upload applepush.csr.
  2. Download the Push Certificate:

    • Save the push certificate and open it in Keychain Access.