# How is a digital certificate generated?

I understand that the role of a Certificate Authority is to SIGN (not encrypt) a certificate. The signed certificate will theoretically contain:

1. Plain text of data, including the server's public key
2. Signature of hashed version of plain text of data in (1) so that a user can verify (using CA public key) that the certificate has not been tampered with.

Knowing these two key points, I tried to play around with an example cert

-----BEGIN CERTIFICATE-----
MIIF7zCCBNegAwIBAgIRANdVj9r18RBbshMoK3B3KaMwDQYJKoZIhvcNAQEFBQAw
gZcxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJVVDEXMBUGA1UEBxMOU2FsdCBMYWtl
IENpdHkxHjAcBgNVBAoTFVRoZSBVU0VSVFJVU1QgTmV0d29yazEhMB8GA1UECxMY
aHR0cDovL3d3dy51c2VydHJ1c3QuY29tMR8wHQYDVQQDExZVVE4tVVNFUkZpcnN0
LUhhcmR3YXJlMB4XDTExMDMxNTAwMDAwMFoXDTE0MDMxNDIzNTk1OVowgd8xCzAJ
BgNVBAYTAlVTMQ4wDAYDVQQREwUzODQ3NzEQMA4GA1UECBMHRmxvcmlkYTEQMA4G
C0dvb2dsZSBMdGQuMRMwEQYDVQQLEwpUZWNoIERlcHQuMSgwJgYDVQQLEx9Ib3N0
...
-----END CERTIFICATE-----


I tried decoding using Base64 decoder, and the result is gibberish. I tried googling for answers but I'm not getting anywhere.

1. What encoding scheme is this and does this offer extra layer of security?
2. Shouldn't the main ideas (point 1 and 2) be secure enough?
3. Is there a way I can break this blob down to visually show that data part and the signature part?
• If you have openssl on your system then openssl x509 -in name-of-cert-file -noout -text will give you a human readble version of the certificate – Matt Caswell Jan 10 '20 at 14:48

1. Plain text of data, including server's public key

Yes, and many other public information, including something identifying the holder of the public key (perhaps in the Common Name field).

1. Signature of hashed version of plain text

Yes, except that the correct semantic is: Signature of the plain text. Building and verifying the signature includes hashing plain text.

What encoding scheme is this?

See RFC 7468 section 5 and what it references, including RFC 1421 section 4.3.2.4 for the translation of binary to text (which in a nutshell is per Base64).

Does this offer extra layer of security?

From a cryptographic standpoint, no. That's merely a binary-to-text encoding, see this for rationale.

Shouldn't the main ideas (point 1 and 2) be secure enough?

Yes, they are.

Is there a way I can break this blob down to visually show that data part and the signature part?

When there's any non-confidential piece of standard text-encoded stuff to decode, it can be thrown at the marvelous https://lapo.it/asn1js/ (with or without the delimiters) and the results are usually pretty good. When in doubt about the confidentiality, use a local copy in an isolated VM.

• Thank you. Do you know the benefits of using x509 vs base 64 of json string for example – Zanko Jan 10 '20 at 16:44
• @Zanko: X.509 does not oppose to Base64, which happens to be the binary-to-text encoding used (I added references). X.509 (and what it references) defines the format of the binary blob. Won't comment "base 64 of json string", for that's squarely off-topic (even more than the details of the certificate format). – fgrieu Jan 10 '20 at 16:59