Skip to main content

Understanding PKI The Complete Process Explained

The Complete Public Key Infrastructure (PKI) Process: From Key Generation to Certificate Verification

Public Key Infrastructure (PKI) is the backbone of secure communication on the internet. It ensures that sensitive data exchanged between clients and servers remains private and authentic. This blog post will guide you through the entire PKI process, from generating keys to verifying certificates and ensuring they haven't been revoked.


1. Key Pair Generation

The first step in PKI is generating a public-private key pair using an asymmetric cryptographic algorithm, such as RSA or ECDSA:

  • The private key is securely stored on the server and never shared.

  • The public key is included in the certificate and shared with the Certificate Authority (CA) during the certificate request process.

This key pair enables encryption and decryption, which are essential for secure communication.


2. Creating a Certificate Signing Request (CSR)

The server creates a Certificate Signing Request (CSR) to request a certificate from a trusted CA. The CSR includes:

  • The public key.

  • The server’s identity details (e.g., domain name, organization, location).

The CSR is then submitted to the CA for validation.


3. CA Issues the Certificate

Once the CA receives the CSR, it performs the following steps:

a. Validation

The CA verifies the server's identity using various methods, such as domain ownership verification or organizational checks. This ensures that the entity requesting the certificate is legitimate.

b. Hashing and Signing

  1. The CA creates a hash of the certificate data (e.g., public key and identity information) using a secure hashing algorithm like SHA-256.

  2. The CA then encrypts this hash with its private key to create a digital signature.

  3. The CA packages the public key, server identity details, and the digital signature into the certificate.

The resulting certificate guarantees the authenticity of the server and the integrity of the data.


4. Installing the Certificate on the Server

After receiving the signed certificate, the server installs it along with the private key. The certificate is often accompanied by intermediate CA certificates to establish a chain of trust. These certificates are essential for ensuring compatibility with all client devices.


5. Client-Server Communication (TLS Handshake)

When a client (e.g., a browser) connects to the server, the server presents its certificate during the TLS handshake. The client then validates the certificate through the following steps:

a. Signature Verification

  1. The client extracts the digital signature from the server’s certificate.

  2. Using the CA’s public key (from the client’s trusted root store), the client decrypts the signature to retrieve the original hash.

  3. The client recomputes the hash of the certificate data and compares it with the decrypted hash.

    • If the hashes match, the certificate is authentic and untampered.

    • If they don’t match, the certificate is invalid.

b. Domain Validation

The client ensures that the certificate’s Common Name (CN) or Subject Alternative Name (SAN) matches the domain it’s trying to connect to.

c. Validity Period Check

The client verifies that the certificate is within its validity period. Expired certificates are deemed invalid.


6. Checking Certificate Revocation

To ensure that the certificate hasn’t been revoked, the client performs one of the following checks:

a. Certificate Revocation List (CRL)

  • The certificate contains a link to a CRL provided by the CA.

  • The client downloads the CRL and checks whether the certificate’s serial number is on the list.

b. Online Certificate Status Protocol (OCSP)

  • The certificate includes an OCSP endpoint (URL) provided by the CA.

  • The client sends a real-time query to the CA’s OCSP server to check the certificate’s revocation status.

c. OCSP Stapling

  • The server pre-fetches the OCSP response from the CA and includes it in the TLS handshake.

  • This method reduces latency and improves performance by eliminating the need for the client to query the CA directly.


7. Establishing Secure Communication

Once the certificate is verified, the client and server establish a secure channel:

  1. The client generates a session key for encryption.

  2. The client encrypts the session key using the server’s public key (from the certificate).

  3. The server decrypts the session key using its private key.

  4. Both parties use the session key for symmetric encryption to ensure fast and secure communication.


8. Summary of the Entire Process

Preparation

  1. Generate a public-private key pair.

  2. Create and submit a CSR to a CA.

CA’s Role

  1. Validate the server’s identity.

  2. Hash the CSR data, sign it with the CA’s private key, and issue the certificate.

Server Installs the Certificate

  1. Install the certificate and the private key on the server.

TLS Handshake (Client-Server Communication)

  1. Server sends its certificate to the client.

  2. Client validates the certificate:

    • Signature verification.

    • Domain name match.

    • Check revocation (via CRL or OCSP).

Establish Secure Communication

  1. Client and server establish a secure connection using symmetric encryption.


Comments

Popular posts from this blog

How to import Putty Saved Connections to mRemoteNG

Just started using mRemoteNG and its being very cool to connect to different remote connection with different protocols e.g Window Remote Desktop, VNC to Linux, SSH, HTTP connection etc. from a single application. As new user I configured some remote desktop connection which was quite easy to figure out. But when I wanted to add SSH connections, it came in my mind to import all of the saved connections in the putty. But I couldn't figure it out how can it be done, though it was quite easy and here are the steps. Open your mRemoteNG Create a folder if you want segregation of multiple networks Create a new connection Enter the IP address of remote server under connection in Config pane Under the config pane, select protocol " SSH version 2 ".  Once you select protocol to SSH version 2 you are given option to import putty sessions, as shown in the snap below. In the above snap, I have imported CSR-AWS session from my saved sessions in Putty.

Authoritative DNS Servers Delegation and Internal DNS Explained

DNS (Domain Name System) plays a critical role in how users and systems find resources on the internet or within internal networks. Whether it's managing an internal domain in an enterprise or delegating parts of a domain for traffic distribution, DNS setups vary widely depending on needs. In this blog post, we’ll break down the different types of DNS setups, including authoritative DNS servers, DNS delegation, and how internal DNS functions within organizations. 1. Authoritative DNS Server An Authoritative DNS server is the final source of truth for a specific domain. When someone queries a domain (e.g., example.com ), the authoritative DNS server for that domain holds the DNS records (A records, CNAME, MX, etc.) and responds with the corresponding IP address. Key Points: Who can host it? Authoritative DNS servers are often hosted by domain registrars (e.g., GoDaddy, Namecheap) or cloud DNS providers (e.g., AWS Route 53, Cloudflare). However, organizations can also host their ...

SSL VPN vs IPSec VPN: Understanding the Key Differences

When it comes to securing communication over the internet, Virtual Private Networks (VPNs) are a cornerstone of modern networking. Two popular types of VPNs are SSL VPN and IPSec VPN . While both serve to encrypt and secure data, they differ significantly in terms of technology, use cases, and implementation. This blog post will help you understand these differences and choose the right solution for your needs. What is SSL VPN? An SSL VPN uses the Secure Sockets Layer (SSL) or its successor, Transport Layer Security (TLS) , to create a secure connection. It operates at the Application Layer (Layer 7) of the OSI model and is designed to provide secure access to specific resources over the internet. Key Features of SSL VPN: Ease of Use: Accessible via a standard web browser without the need for dedicated client software. Granular Access Control: Allows users to access specific applications or resources rather than the entire network. Port Usage: Uses TCP port 443, which is rarely...