3 ms·
Best practice would be to use an HSM to store the key. It provides the usability benefits of an unencrypted private key with strong guarantees about the securit
by garrettr_ 12y ago
Best practice would be to use an HSM to store the key. It provides the usability benefits of an unencrypted private key with strong guarantees about the security of that key.
It's worth noting that the security benefits of encrypting the private key are limited in most cases. Whenever the server restarts, the private key is decrypted and stored in memory, so an attacker who can exploit your web server would be able to access it anyway. Some attackers might not be able to access memory (e.g. exploits in a web application), but in that case you should be able to use standard file permissions to protect the key.
Encrypting the key would have more benefit if you are planning to store it in places other than the server it is used on, and/or transfer it across a network. In that case, it's probably best to carefully consider your threat model and security requirements, rather than solely relying on the default encryption provided by OpenSSL. For example - do you have the discipline do use a strong, unique passphrase on that key? If not, encrypting the key doesn't provide much protection against a determined attacker. Is stretching performed to slow down a brute force attacker? And so on...
- nailer 12y ago+1. I believe HSMs may even be required for CAs.