How to generate a key file out of a .cert?

Is it possible to make the key file with .cert or .p7b file?

No.

Some administrators keep the private key in the same file as the public portion of the certificate, however .p7b files do not contain private keys: they only contain the public key certificate & certificate chain.
You need the corresponding .key file to use the certificate.


As Zoredache said the entire point of public key cryptography is that you have two parts: A public half (.cert file) which encrypts data, and a private half (.key file) which lets you decrypt it again.

The contents of the cert file are given to everyone who connects to your server. It would defeat the purpose of encrypting data if that information were usable to decrypt the traffic too.

For more information refer to the Wikipedia page on public-key cryptography and/or the page on SSL/TLS