Thanks Quinn,
Yes, the certificate got munged in the copy/paste. The new code is larger than the answer character limit, so it's attached as a file. I had to put a .txt extension on it to get it to upload.
Quick note for anybody who comes upon this in the future, here are the shell commands I used to transform a PEM formatted file "test.pem" into the format Quinn requested, replace filenames as appropriate. You can copy and paste the results from the terminal right into a swift array in Xcode between the brackets.
openssl x509 -in test.pem -out test.der -outform DER
hexdump -v -e '1/1 "0x%02, "' test.der
main.txt
Also of note for any future readers, this code contains a self signed CA certificate(root). I have deleted the private key, but why should you trust me? When you run the code it will import the certificate, but it will be untrusted. Remember to use Keychain Access to delete the certificate after running the code. If it were to become trusted somehow it would be a big security hole on your system If I still had the private key.
Topic:
App & System Services
SubTopic:
General
Tags: