Search code examples
algorithmencryptionopensslssl-certificatex509

How can I use different encryption algorithms in OpenSSL for X.509 certificates?


I've been generating certificates for internal use at a company that may end up becoming more widespread as time progresses (rather than just on a single internal website). I've noticed that, when using OpenSSL, the certificates being generated show as using AES_256_CBC in Chrome, as shown below.

Chrome showing AES_256_CBC

I've been wondering, is it possible to use other encryption algorithms with OpenSSL? I've seen certificates for other websites showing up as using algorithms such as RC4_128, and CAMELLIA_256_CBC.

If it helps, I have two versions of OpenSSL installed; 0.9.8l and 1.0.1c, and I'm using Windows 7. These certificates are also chained; one root certificate, one intermediate certificate, and then the certificate used for the website.

Thanks for your time.


Solution

  • Short answer

    Yes, you can use other encryption algorithms but X.509 certificates play a very small role in that.

    In order to do that without modifying the client you must configure your server to favour some cipher suites over the others (e.g. for Apache have a look at the SSLCipherSuite configuration).

    If you can modify the client but not the server, you must reorder the cipher suites your client offers during the handshake. The ones with your preferred algorithm should come first. Alternatively, you can remove the ones with encryption algorithms that you don't like (even though that means that connections may fail because of that).

    Long answer

    The encryption algorithm used on a SSL/TLS connection is negotiated during the handshake. The client sends to the server the cipher suites it supports, ordered according to its preference. The server picks the one it likes most.

    A cipher suite (e.g. TLS_RSA_WITH_AES_128_CBC_SHA) is a tuple that indicates which algorithms must be used for:

    • Authentication
    • Key exchange
    • Bulk encryption
    • Cryptographic digest

    The content of the server X.509 certificate plays a small role in this process in that it limits how authentication and key exchange will be done. If the server certificate contains an RSA key, the cipher suite cannot be any of the ones starting with TLS_DH_DSS_*.

    Theoretically, the server X.509 certificate is independent from the bulk encryption algorithm. However, since not all possible combinations are covered (or offered by the client), the type of key in the server cetificate may rule out some ciphers.