Search code examples
sslopensslcertificate

Is there a difference between certificates used for TLS/SSL and Identity (signing)?


Is there a difference between certificates, let's say from Apple for signing or Let's Encrypt for TLS/SSL? Are they interchangeable or when generated do they have specific params that make one good for ID and one good for encryption?


Solution

  • Depending on what you mean, they're either exactly the same, or they're different. (Isn't language grand?)

    A code-signing certificate and a TLS server certificate and a TLS client certificate are all X.509 Public Key Certificates, described by IETF RFC 5280 and ITU-T X.509 (whence the name).

    Within the certificate there's a(n optional) set of extensions (the well-defined ones were extending the rigid structure of the previous data versions). One of these extensions is called Extended Key Usage (which, confusingly, is described by X509EnhancedKeyUsageExtension in .NET), generally abbreviated as EKU. The EKU extension is just a list of identifiers that indicate to what purposes the certificate is valid. (Organizations like the CA/Browser Forum come up with rules for what a CA has to do before allowing each specific type of purpose to be claimed.)

    The current certificate I see for stackoverflow.com has two listed purposes: 1.3.6.1.5.5.7.3.1 and 1.3.6.1.5.5.7.3.2. Those identifiers don't mean much to the general population, though, so many systems will replace them with friendlier names. Firefox 89's description is "Server Authentication, Client Authentication".

    TLS/SSL have a lax approach to EKU: If the certificate has an EKU extension then the TLS Server (1.3.6.1.5.5.7.3.1) or TLS Client (1.3.6.1.5.5.7.3.2) purpose must be present (the correct one for the role it's taking), but if the EKU extension isn't present then the certificate is acceptable.

    RFC 3161 Timestamping is less lax. It requires that the certificate have an EKU extension (and only one of them, which can contain multiple purpose values) which contains the purpose 1.3.6.1.5.5.7.3.8, in section 2.3.

    So, the differences are just in EKU values.

    • TLS Server: 1.3.6.1.5.5.7.3.1
    • TLS Client: 1.3.6.1.5.5.7.3.2
    • Code Signing: 1.3.6.1.5.5.7.3.3
    • Timestamping: 1.3.6.1.5.5.7.3.8

    There are a lot of others in general use, like 1.3.6.1.4.1.311.10.3.5 (Microsoft Windows Hardware Quality Labs Driver Verification), they don't all start with "1.3.6.1.5.5.7.3." (though a good number of the common ones do).