Obtain .cer file from .pem file
You can use the following command:
openssl x509 -inform PEM -in cacert.pem -outform DER -out certificate.cer
The actual extension does not matter for certificates. Usually .pem files have an x509 certificate in base64 encoded form. .cer files may be base64 or DER encoded (Windows will recognise either). Depending on your application you will need to find out which certificate format the application requires.
To convert between base64 (PEM) and DER encoding:
openssl x509 -in cert.pem -outform pem -outform der -out cert.cer
.cer is a filetype for either DER or Base64 encoding, if I recall correctly.
openssl x509 -in cacert.pem -out cacert.cer -inform pem -outform der for DER format.