0
$\begingroup$

I am coming up-to-speed on OpenSSL certificates. In all of my research I see where "data" is hashed to create a hash value that is used as the basis for a certificate's digital signature. This hash value is encrypted using the sender's private key, at which point it becomes the certificate's digital signature.

What "data" is hashed? Is it specific information from the certificate? Is it all certificate information? Does the the data include the certificate's public key? Or, is the data some random number or string that is generated by OpenSSL when the certificate is created? I'm assuming that the "data" is certificate data since one of the functions of PKI is to validate that the contents of a message (in this case a certificate) haven't changed since the message was created.

$\endgroup$
  • $\begingroup$ This is not specific to OpenSSL, which implements certificates defined by X.509 and PKIX, standards also implemented by thousands of other programs. For a concrete, detailed example of the verification side, see security.stackexchange.com/questions/127095/… (disclosure: I provided a chunk of the answer) $\endgroup$ – dave_thompson_085 Jun 7 at 23:24
3
$\begingroup$

This applies over the entire certificate data. Per RFC 5280, section 4.1.1.3:

   The signatureValue field contains a digital signature computed upon
   the ASN.1 DER encoded tbsCertificate.  The ASN.1 DER encoded
   tbsCertificate is used as the input to the signature function.  This
   signature value is encoded as a BIT STRING and included in the
   signature field.  The details of this process are specified for each
   of the algorithms listed in [RFC3279], [RFC4055], and [RFC4491].

   By generating this signature, a CA certifies the validity of the
   information in the tbsCertificate field.  In particular, the CA
   certifies the binding between the public key material and the subject
   of the certificate.

So every single field of the certificate is part of the signature (except of course for the signature). This is to guarantee that no element of it was tampered with (there is pretty much no field in the certificate that is not important. Even if one were, it's easier to require everything to be signed regardless of the use).

About public keys:

  • subject public key is definitely included. Note the last sentence I quoted. This is one of the critical parts of the certificate: who it was issued to.
  • issuer public key is not included in the certificate and therefore is not part of the signature. Instead, the subject field of the issuer is included as well as the Certificate Authority Key ID which can be found in the issuer's certificate under Subject Key ID. This is used in path building.
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks for the explanation, @Marc! This is EXACTLY what I was looking for. I confirmed in RFC 5280, Sections 4.1.1.1 and 4.1.2 that the public key IS included as a field in the data that is used to generate the hash value that is used to generate the certificate's digital signature. $\endgroup$ – Bill Vallance Jun 7 at 19:08
  • $\begingroup$ Note my edit: the subject public key has to be. The issuer public key is not part of the certificate or signature (but its ID is). $\endgroup$ – Marc Jun 7 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.