Search code examples
sslopensslcertificatessl-certificate

Can I sign a certificate request for third-level with a private key of second-level domain?


Suppose I own a regular (non-wild-card) SSL certificate for example.com.

I want to become a Certificate Authority for all the subdomains of example.com. E.g. I want to emit a certificate request for wiki.example.com and sign it with private key of example.com, which was signed by Comodo/Thawte/whatever.

Would browsers consider cert chain wiki.example.com -> example.com -> Thawte a valid one?


Solution

  • No. Well, you can use the private key of you example.com certificate to sign a certificate for wiki.example.com and set example.com certificate as 'issuer' for wiki.example.com, but all browsers will reject such certificate chain.

    The reason is that each certificate has "Key Usage" fields. Your certificate for "example.com" will have the following allowed usages:

    X509v3 Extended Key Usage: 
            TLS Web Server Authentication, TLS Web Client Authentication
    

    All reasonable SSL validator must reject this certificate as a CA certificate, since CA certicate must be

    X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
    

    UPDATE

    As @dave_thompson_085 mentioned, certificates must have field "Basic Constraints" that contains "CA" boolean flag. Bit flags "KeyUsage.keyCertSign" ("X509v3 Key Usage: Certificate Sign" in the Openssl output) and "BasicConstraints.CA" ("X509v3 Basic Constraints: CA" in the Openssl output) are asserted together (see RFC 5280, section 4.2.1.3).

    The private key for example.com might be used for intermediate CA only when both bits are set.