convert trailers.pem to trailers.cer

I had a trailers.pem installed on a bunch of my plexconnect hosts so I did not want to generate and load a new one on to my hosts for when I use my appletv's locally and remotely. I also deleted my original trailers.cer that went with that trailers.pem so I couldn't utilize the network method to load my trailers.cer to my PlexConnect clients since I did not know at the time you could use it via over the network via plexconnects built-in webserver. I was always using a apache2 webserver to send my trailers.pem not knowing it was not the default method to my appletv locally using this method (among other stuff like addsite.mc or bag.plists).

 

http://forums.plexap...bserver-on-osx/

 

But now that there is this new method I wanted to keep and convert my trailers.pem back to a trailers.cer so I could use it locally (or remotely using the prior link):

 

https://github.com/i...to-your-appletv

 

Here is how I did it on OSX via terminal:

 

openssl x509 -inform PEM -in trailers.pem -out trailers.cer

 

This extracts the public key which is all the trailers.cer basically is.

 

Then I was able to load trailers.cer locally using plexconnect/apache2 or remotely using apache2.

 

Hope this helps someone. Also I noticed when I make a trailers.cer with createcert.bash it looks to be encrypted but when I convert it with this it does not yet it still installs as a profile on the atv and allows plexconnect to still function. I kind of like it better because I can at least read it and backup the contents in case I lose these files to just paste the keys back over :)

If you look at the current /support/OSX/createcert.bash:

>> cat ./assets/certificates/trailers.cer ./assets/certificates/trailers.key >> ./assets/certificates/trailers.pem

...you will notice, that the PEM file is just an concatenation of CER and KEY - when stored in a nicely readable format (Base64?). You can just as easily cut the PEM file again.

Well thats the issue. I generated the cer, key and pem on a different machine thats currently not operational and installed that pem on a bunch of plexconnect hosts. I deleted the key and cer and only had the pem until I extracted the cer portion using the method on the OP. Is there another way to extract the public key from the pem using a different method to something? I typically use textedit on OSX to view the pem. Do I just use this "base64" program to read the pem? Here are some screen shots of the difference when normally generating the cer using createcert.bash or using OpenSSL/textedit to strip out private key. If these is a easier method im all for it, im just saying what worked for me fairly easily to make the cer look unencrypted in textedit since I only have the pem since I deleted the key and cert.
 
-update
 
On OSX using only textedit I was able to just copy the pem, cut out the private key portion, rename it to trailers.cer and upload it to the Apple TV hosting it via plexconnect or apache2 webserver’s :D