# OpenSSL - What Data Is Used To Create A Certificate's Digital Signature?

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.

• 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) – dave_thompson_085 Jun 7 '20 at 23:24

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).