Understanding Certificates in the Digital World
Published: 2024-05-28 15:19:28

### TL;DR
Digital certificates are the digital counterpart to physical ID cards or passports.

Their trustworthiness and validity stems from the reliability and credibility of the issuing entity (the CA,  respectively the government).

### Intro
In our increasingly digital world, ensuring security and authenticity online is more crucial than ever. Whether you're shopping online, accessing your bank account, or simply browsing the web, the need for secure communication and trust in the entities you interact with cannot be overstated. This is where digital certificates come into play. Much like an ID card verifies your identity in the physical world, a digital certificate verifies identities and secures communications in the digital realm.

Let’s dive into what digital certificates are and how they function similarly to ID cards.

### What is a Digital Certificate?

A digital certificate is a digital document used to authenticate the identity of an entity and establish secure communications. Entities can include websites, individuals, devices, or software. Think of it as a virtual passport that confirms the legitimacy of the entity and contributes to ensure that any data transmitted between you and the entity is secure (the certificate alone is not enough, the communication protocol is important as well).

### Contents of a Digital Certificate

1. **Entity Information**:
    - **Subject**: The entity the certificate is issued to. For example, in an SSL/TLS certificate for a website, the subject is typically the domain name of the website.
    - **Issuer**: The entity that issued the certificate. This is usually a Certificate Authority (CA).
    - **Serial Number**: A unique identifier assigned by the issuer to the certificate.
    - **Validity Period**: The period during which the certificate is considered valid, including a start date and an expiration date.
2. **Public Key**:
    - The public key of the entity, used for encryption, digital signatures, or both. This key is mathematically linked to a private key held by the entity.
3. **Digital Signature**:
    - A digital signature created by the issuer using its private key. It ensures the integrity and authenticity of the certificate. If the signature can be verified using the issuer's public key, the certificate is considered valid.
4. **Certificate Extensions**:
    - **Key Usage**: Specifies the cryptographic operations that the public key can be used for, such as encryption, digital signatures, or both.
    - **Subject Alternative Name (SAN)**: Additional identities for which the certificate is valid, such as alternative domain names for a website.
    - **Basic Constraints**: Specifies whether the certificate can be used as a Certificate Authority to issue other certificates.
    - **Extended Key Usage**: Further specifies the purposes for which the public key can be used, such as client authentication, server authentication, or code signing.

> **Notes**
> 1. A certificate is meant to be shared with other entities, which is why...
> 2. The private key is *not* part of the certificate.
> 3. The CA itself may be authenticated by another CA, which might as well be authenticated by another one and so on, until the root CA is attained: this is the CA trust chain.

### How Does an ID Card Work?

1. **Issuance of ID Card**:
    - An individual provides personal information and undergoes identity verification by a relevant authority, such as a government agency or employer, to obtain an ID card.
    - The authority verifies the identity of the requester and issues the ID card containing their personal details and photograph.
2. **Authentication and Identity Verification**:
    - When presenting the ID card, the information on the card is compared with the individual presenting it to verify their identity.
    - This authentication process ensures that the person holding the ID card is indeed the legitimate cardholder and is authorised to access the services or privileges associated with the card.
3. **Access to Privileges and Services**:
    - ID cards grant access to various privileges and services based on the authority associated with the card. For example, a driver's license grants the holder the privilege to operate a motor vehicle.
    - By presenting the ID card, individuals can access these privileges and services, ensuring that only authorised individuals benefit from them.

### How Does a Digital Certificate Work?

1. **Certificate Issuance**: An entity generates a public-private key pair and submits a certificate signing request (CSR) to a Certificate Authority (CA). The CA verifies the identity of the requester and issues a digital certificate containing the public key.
    
2. **Authentication and Secure Communication**:
    - **Websites**: Your browser requests the site’s digital certificate and verifies it, ensuring you are communicating with the legitimate site.
    - **Emails**: Email clients can use certificates to encrypt and sign emails, ensuring confidentiality and authenticity.
    - **Software**: Developers sign their software with certificates to prove that it has not been tampered with.
    - **Individuals**: Digital certificates can authenticate individuals for access to secure systems or documents.

### Types of Digital Certificates

There are different times of digital certificates which serve different purposes:

1. **SSL/TLS Certificates**: Secure communications between browsers and websites.
2. **Client Certificates**: Authenticate users or devices to a server.
3. **Code Signing Certificates**: Verify the identity of the software publisher and ensure the integrity of the software.
4. **Email Certificates (S/MIME Certificates)**: Secure email communications by encrypting and signing emails.
5. **Document Signing Certificates**: Digitally sign documents to ensure their authenticity and integrity.
6. **Root and Intermediate Certificates**: Form the foundation of trust in the PKI hierarchy, used by Certificate Authorities to issue end-entity certificates.
 
> **Types of government-issued IDs** 
> Governments typically issue various types of identification documents to their citizens, residents, and other individuals. These IDs serve different purposes and may vary depending on the country and its regulations. Here are some common types of IDs issued by governments:
> 1. **National Identity Cards (NIC)**:
> 	- National identity cards are government-issued documents that serve as official proof of identity for citizens or residents. They typically include the individual's name, photograph, date of birth, and sometimes other identifying information such as address or identification number.
> 2. **Passports**:
   >	- Passports are travel documents issued by governments to their citizens for international travel. They contain personal information about the passport holder, including their photograph, nationality, date of birth, and passport number.
> 3. **Driver's Licenses**:
>	- Driver's licenses are issued by government agencies to individuals who have passed the required tests to operate motor vehicles legally. In addition to serving as proof of identity, driver's licenses also indicate the holder's authorisation to drive specific types of vehicles.
> 4. **Social Security Cards**:
>	- Social Security cards are issued in some countries to individuals who have registered for government social security programs. They typically contain a unique identification number assigned to the individual for tracking purposes.
> 5. **Residence Permits**:
> 	- Residence permits are issued to non-citizen residents by governments to legally reside in a country for a specified period. These documents typically include the individual's name, photograph, and information about their immigration status.
> 6. **Voter ID Cards**:
> 	- Voter ID cards are issued to eligible voters by election authorities to facilitate voting in elections. They serve as proof of identity and eligibility to vote.
> 7. **Military IDs**:
> 	- Military identification cards are issued to members of the armed forces and their dependent. They serve as proof of military affiliation and may grant access to military facilities and services.
> 8. **Government Employee IDs**:
> 	- Government employee IDs are issued to individuals employed by government agencies. They serve as proof of employment and may grant access to government facilities and services.
> 
> These are just a few examples of the types of IDs that governments commonly issue. The > specific types and requirements for obtaining them vary by country and jurisdiction.

### Digital Certificates vs. ID Cards: The Similarities

Usually, the government trusts local authorities (municipality) to authenticate a person and to make the ID request. The government then creates the ID, which is then handed to the person by the requesting local authority. The role of the government is similar to the role of a CA.

People and organisations usually trust the government-delivered ID: sometimes, this is even mandated by law. This trust in the government is what makes this system robust - whether one likes the government or not.

1. **Identity Verification**:
    - **ID Card**: Confirms your identity with personal details and a photograph, typically issued by a government or other trusted entity.
    - **Digital Certificate**: Confirms the identity of an entity, typically issued by a trusted CA after verifying the entity's credentials.
2. **Trust**:
    - **ID Card**: We trust ID cards because they are issued by recognised authorities like governments.
    - **Digital Certificate**: We trust digital certificates because they are issued by recognised CAs, which follow rigorous verification processes.
3. **Authentication**:
    - **ID Card**: Used to prove your identity when accessing restricted areas, conducting transactions, or during identification checks.
    - **Digital Certificate**: Used to prove the identity of an entity, ensuring secure and authenticated communications.
4. **Security Features**:
    - **ID Card**: Contains physical security features like holograms, watermarks, and micro-printing to prevent forgery.
    - **Digital Certificate**: Contains cryptographic elements like public keys and digital signatures to prevent tampering and ensure authenticity.
5. **Validity period:**
	- **ID Card**: Has an expiration date.
	- **Digital Certificate**: Has a limited validity period which specifies the time frame during which it is considered valid and trustworthy. After the expiration date, the certificate is no longer considered valid, and relying parties should not trust it for secure communications.
6. **Renewal Process:**
    - **ID Card**: Must be renewed before it expires. Renewal typically involves obtaining a new ID from the issuing government and only using the new one (in some countries, authorities may even require that old IDs are given back to the government).
	- **Digital Certificate**: Must be renew by their holders before they expire to ensure uninterrupted secure communication. Renewal typically involves obtaining a new certificate from the issuing Certificate Authority (CA) and replacing the old certificate with the new one.
7. **Types:**
	- **ID Card:** Various types of IDs are issued by governments and are used for different purposes.
	- **Digital Certificate:** Various types of digital certificates are used for different purposes.

### Practical Examples of Digital Certificates in Use

1. **Secure Web Browsing**: When you visit a website starting with `https://`, the communication protocol and the site’s digital certificate ensure that your communication with the site is encrypted and secure, protecting sensitive information like passwords and credit card numbers.
    
2. **Email Security**: Digital certificates can secure email communications by encrypting emails and enabling digital signatures, ensuring that your emails are confidential and authenticated.
    
3. **Software Integrity**: Developers use digital certificates to sign software, ensuring users that the software has not been tampered with and is from a legitimate source.
    
4. **Individual Authentication**: Organisations issue digital certificates to employees, enabling secure access to corporate systems and data. These certificates ensure that only authorised individuals can access sensitive information.
    
5. **Document Signing**: Digital certificates are used to sign electronic documents, providing a digital equivalent of a handwritten signature and ensuring the document’s integrity and authenticity.
    

### Conclusion

Digital certificates play a vital role in maintaining trust and security in the digital world, much like ID cards do in the physical world. They verify the identities of entities, establish secure communications, and ensure data integrity. By understanding how digital certificates function and their similarities to ID cards, we can better appreciate the underlying mechanisms that keep our online interactions safe and trustworthy. So next time you encounter a digital certificate, you’ll know that it is hard at work, verifying identities and securing your digital environment.