Search code examples
phpencryptionssltheorynodes

Sending encrypted data between servers without SSL in Apache


I have several independent PHP applications running on few servers. None of the servers have SSL, but I'm able to use PHP wraper for SSL. I would like to ensure all data sent between servers is safe and signed. Do I need to generate an certificate or is it enough to create public/private key everytime I send something? Is this aproach safe?


Solution

  • Do I need to generate an certificate or is it enough to create public/private key everytime I send something?

    Don't generate a public/private key every time. How would you be able to check who has control over the private key? The point of certificates is to be able to bind an identity to a public key: checking you trust the certificate and that you're willing to communicate with the identity it refers to is a necessary component to secure the communication.

    From what I understand, the communication between the servers doesn't involve user interaction itself. If you control all the servers, you could give them certificates, either self-signed X.509 certificates (if you can install them all for all parties: only applicable for small numbers in practice) or your own CA (if you have OpenSSL, look into CA.pl, which has a man-page).

    You could then sign an encrypt the content you exchange using S/MIME (there are functions available in PHP for this).

    (You might also be able to achieve the same goal using PGP, using PGP keys/certificates instead.)