Managed Identity vs Client Secret :👈 👉:SHA-256 with RSA

SSL/TLS Certificate

SSL/TLS Certificate – Complete Explanation

1. What is an SSL/TLS Certificate?

An SSL/TLS certificate is a digital document that helps a website or server prove its identity and establish a secure, encrypted connection with a client such as a web browser or application.

For example, when you visit:

https://example.com

The website uses a TLS certificate to help the browser:

  • Verify that it is communicating with the correct website.
  • Verify the website's public key.
  • Establish secure communication.
  • Protect information exchanged between the browser and server.

SSL: Secure Sockets Layer is the older protocol.

TLS: Transport Layer Security is its modern replacement.

Although people commonly say SSL certificate, modern websites use TLS certificates.

Example

HTTP HTTPS
http://example.com https://example.com
Does not provide TLS encryption. Uses TLS to establish secure communication.
Default port: 80 Default port: 443

2. Why Do We Need an SSL/TLS Certificate?

Consider an application where users enter login credentials, personal information, or payment information.

Without HTTPS, information could be exposed or modified while travelling across an untrusted network.

TLS helps provide the following security properties:

1. Encryption

Protects information exchanged between the client and server from being read by unauthorized parties.

2. Authentication

Helps the client verify the identity of the server using its certificate.

3. Integrity

Helps detect unauthorized modification of information during communication.

Important: A TLS certificate does not encrypt all application data by itself. It participates in the TLS handshake, which establishes cryptographic keys used to protect the communication.

3. What Is the Structure of an SSL/TLS Certificate?

Most website TLS certificates follow the X.509 Version 3 standard.

An X.509 certificate contains identity information, a public key, validity information, issuer information, extensions, and a digital signature.

Basic Certificate Structure

X.509 Certificate 1. TBSCertificate Version Serial Number Signature Algorithm Issuer Validity Not Before Not After Subject Subject Public Key Information Extensions 2. Signature Algorithm 3. Signature Value

1. Version

Specifies the version of the X.509 certificate format.

Commonly used for website certificates:

Version: 3

2. Serial Number

A unique number assigned by the Certificate Authority (CA) to identify the certificate it issues.

Serial Number: 45A7B92C108F

3. Signature Algorithm

Identifies the cryptographic algorithm used by the Certificate Authority to digitally sign the certificate.

Examples include:

  • SHA256 with RSA
  • ECDSA with SHA-256

4. Issuer

Identifies the Certificate Authority that issued the certificate.

Example:

Issuer:
    Organization: Example Certificate Authority
    Country: US

5. Validity

Specifies the period during which the certificate is valid.

It contains two important dates:

  • Not Before: The date from which the certificate becomes valid.
  • Not After: The date on which the certificate expires.

Example:

Not Before: 2026-01-01
Not After:  2027-01-01

After expiration, the certificate must be renewed or replaced.

6. Subject

Identifies the website, server, organization, or other entity for which the certificate was issued.

Example:

Subject:
    Common Name: example.com
    Organization: Example Technologies
    Country: IN

For modern TLS certificates, the Subject Alternative Name (SAN) extension is particularly important. Browsers check the requested hostname against the names in SAN.

7. Subject Public Key Information

Contains the public key associated with the certificate owner and information about its cryptographic algorithm.

Example:

Public Key Algorithm: RSA
Public Key Size: 2048 bits

The corresponding private key is not included in the certificate. It must be stored securely by the certificate owner.

8. Extensions

Extensions provide additional information about the certificate and how it can be used.

Extension Purpose
Subject Alternative Name (SAN) Specifies the DNS names or IP addresses covered by the certificate.
Key Usage Defines permitted cryptographic uses of the key.
Extended Key Usage (EKU) Specifies purposes such as TLS server authentication.
Basic Constraints Indicates whether the certificate belongs to a Certificate Authority.
Subject Key Identifier Identifies the public key in the certificate.
Authority Key Identifier Helps identify the key of the issuing CA.
CRL Distribution Points Provides information about certificate revocation lists.
Authority Information Access Can provide information about the issuing CA and certificate status services.

9. Signature Value

The Certificate Authority digitally signs the certificate information using its private signing key.

The signature allows clients to verify that the certificate was issued by the claimed CA and has not been modified.

4. What Is the Difference Between Public Key and Private Key?

TLS certificates are based on public-key cryptography.

A public/private key pair contains two mathematically related keys.

Public Key Private Key
Can be shared publicly. Must remain confidential.
Included in the certificate. Not included in the public certificate.
Used as part of public-key cryptographic operations. Used for private-key operations, including signing or key establishment, depending on the algorithm.

Example:

Public Key  = Shared through the certificate
Private Key = Kept securely by the certificate owner

Important: In modern TLS, the certificate public key normally authenticates the server during the handshake. TLS 1.3 uses ephemeral key exchange to establish session keys; it does not simply encrypt all website traffic with the certificate's public key.

5. Who Creates the SSL/TLS Certificate?

A TLS certificate is generally issued by an organization called a Certificate Authority (CA).

Major TLS Certificate Authorities (CAs) are trusted by global root programs (such as Mozilla, Apple, Microsoft, and Google Chrome).

Top & Leading TLS Certificate Authorities

  • Let's Encrypt (ISRG): Holds the largest market share (approx. 64.3%), offering automated, free 90-day DV certificates.
  • GlobalSign: Second-largest market share (approx. 21.1%), widely used for enterprise and API-driven PKI solutions.
  • Sectigo (formerly Comodo CA): Major commercial provider; owns sub-brands like USERTrust and Comodo.
  • DigiCert: Industry leader in enterprise, post-quantum options, and high-assurance certificates; owns GeoTrust, Thawte, RapidSSL, and QuoVadis.
  • GoDaddy (including Starfield): Popular commercial web hosting and TLS certificate provider.
  • Amazon (AWS Certificate Manager): Widely used for automated cloud certificate issuance and management.
  • Google Trust Services (GTS): Operates Google's public roots and issues certificates for internal and external services.
  • SSL.com: Offers commercial and automated ACME-supported certificates; owns Trustwave and SecureTrust.

There are two important parties involved:

1. Certificate Owner

The website owner or application administrator requests the certificate.

Typically, the certificate owner or its server generates:

  • Private key
  • Public key
  • Certificate Signing Request (CSR)

2. Certificate Authority (CA)

The CA verifies the request according to its issuance requirements and issues the signed certificate.

The CA generally:

  • Validates control of the domain or other required identity information.
  • Checks the Certificate Signing Request.
  • Issues and digitally signs the certificate.
  • Provides the issued certificate and relevant intermediate certificates.

Important: The CA normally does not need your private key. The private key stays with the certificate owner or within the secure service generating the key.

6. What Is a Certificate Signing Request (CSR)?

A Certificate Signing Request (CSR) is a request file generated by the certificate owner and submitted to a Certificate Authority.

It contains information such as:

  • Domain name
  • Organization information, when applicable
  • Country and location information, when applicable
  • Public key
  • Requested certificate extensions

The CSR is signed using the corresponding private key to demonstrate possession of that key.

Important: The CSR contains the public key, not the private key.

CSR Creation Process

Website Owner Generate Key Pair Public Key Private Key Kept Secret, Never Sent to CA Create CSR Certificate Signing Request (Contains Public Key) Submit CSR Certificate Authority (CA) Domain Validation Signs Public Key Signed TLS Certificate Install Certificate + Private Key

7. Complete SSL/TLS Certificate Issuance Process

  1. Purchase or request a certificate: The website owner chooses a Certificate Authority or certificate service.
  2. Generate a key pair: Generate a public key and private key, preferably in a secure environment.
  3. Generate a CSR: Create a Certificate Signing Request containing the public key and requested identity information.
  4. Submit the CSR: Send the CSR to the Certificate Authority.
  5. Domain validation: The CA verifies control of the requested domain, commonly using DNS or HTTP-based validation.
  6. Certificate issuance: The CA signs and issues the certificate.
  7. Install the certificate: Configure the certificate and private key on the web server, load balancer, or hosting service.
  8. Configure HTTPS: Enable TLS and configure the server to present the certificate and required intermediate certificates.
  9. Verify: Check the certificate, hostname, validity, trust chain, and HTTPS connection.

8. What Is a Certificate Chain?

A certificate chain is a sequence of certificates used to establish trust between a website certificate and a trusted Root Certificate Authority.

It commonly contains three levels:

1. Root Certificate

The Root CA certificate is the trust anchor. It is usually self-signed and distributed through trusted operating system and browser trust stores.

2. Intermediate Certificate

An Intermediate CA certificate is issued by a Root CA or another Intermediate CA. It is used to issue website certificates.

3. Server or Leaf Certificate

This is the certificate issued for your website or server.

Certificate Chain Structure

Trusted Root CA Signs Intermediate CA Signs Website TLS Certificate example.com Certificate Trust Chain Browser trusts Root CA → Root trusts Intermediate CA → Intermediate CA trusts Website Certificate

The browser validates the certificate chain and checks whether it leads to a trusted root.

9. Different Types of SSL/TLS Certificates

1. Domain Validated (DV)

Validates control of the domain name. Commonly used for personal websites, blogs, and ordinary web applications.

2. Organization Validated (OV)

Includes additional organization identity validation by the Certificate Authority.

3. Extended Validation (EV)

Uses a more extensive organization validation process. It does not provide stronger TLS encryption merely because it is EV.

4. Wildcard Certificate

Covers a domain and its matching first-level subdomains.

Example:

*.example.com

It can cover:

  • www.example.com
  • api.example.com
  • admin.example.com

It does not automatically cover example.com itself or deeper names such as api.dev.example.com.

5. Multi-Domain Certificate

A certificate containing multiple DNS names in its Subject Alternative Name extension.

Example:

example.com
example.in
mywebsite.com

10. How to Create an SSL/TLS Certificate

There are several ways to create or obtain a certificate, depending on where the application is hosted.

Method 1: Obtain a Certificate from a Certificate Authority

This is the normal approach for a publicly accessible production website.

  1. Choose a trusted Certificate Authority.
  2. Generate a private key and CSR.
  3. Submit the CSR to the CA.
  4. Complete domain validation.
  5. Download the issued certificate and intermediate certificates.
  6. Install them on your web server or hosting platform.

Method 2: Create a Self-Signed Certificate

A self-signed certificate is a certificate signed using its own private key rather than being issued by a publicly trusted CA.

It is useful for:

  • Local development.
  • Testing HTTPS configuration.
  • Controlled internal environments where the certificate is explicitly trusted.

It is generally not appropriate for a public website because browsers do not automatically trust an arbitrary self-signed certificate.

Example: Create a Development Certificate Using PowerShell

$cert = New-SelfSignedCertificate `
    -DnsName "localhost" `
    -CertStoreLocation "Cert:\CurrentUser\My" `
    -FriendlyName "Local Development Certificate"
$cert

This creates a self-signed certificate for local development in the current user's certificate store.

Export the Certificate as PFX

$password = Read-Host "Enter password" -AsSecureString
Export-PfxCertificate `
    -Cert $cert `
    -FilePath ".\localhost.pfx" `
    -Password $password

The PFX file contains the certificate and its private key. Protect it with a strong password and restrict access to the file.

Method 3: Generate a CSR Using OpenSSL

OpenSSL is a widely used tool for generating cryptographic keys and Certificate Signing Requests.

First, create an OpenSSL configuration file named openssl.cnf:

[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
req_extensions = req_ext
[dn]
C = IN
ST = Telangana
L = Hyderabad
O = Example Technologies
CN = example.com
[req_ext]
subjectAltName = @alt_names
[alt_names]
DNS.1 = example.com
DNS.2 = www.example.com

Generate a private key and CSR:

openssl req -new -newkey rsa:2048 \
-keyout example.com.key \
-out example.com.csr \
-config openssl.cnf

This command creates:

  • example.com.key: Private key. Keep it secure.
  • example.com.csr: Certificate Signing Request. Submit this to the CA.

After the CA validates the domain and issues the certificate, you receive the signed certificate and possibly intermediate certificates.

Note: The private key generated in this example must be protected. Do not upload it to the CA or commit it to source control.

11. Common Certificate File Formats

Extension Purpose
.cer Usually contains a certificate without its private key.
.crt Usually contains a certificate without its private key.
.pem Text-based encoding that can contain certificates, private keys, or CSRs.
.key Common filename extension for a private key.
.csr Certificate Signing Request.
.pfx / .p12 PKCS#12 container that can contain a certificate, private key, and certificate chain.
.der Binary DER-encoded certificate or other ASN.1 data.

Important: File extensions alone do not guarantee what a file contains. Always inspect the certificate or container before using it.

12. How Does HTTPS Work Between Browser and Server?

When a browser connects to an HTTPS website, the TLS handshake takes place before protected application data is exchanged.

Simplified TLS Handshake

TLS Handshake and Certificate Validation Process Browser / Client 1. ClientHello Supported TLS Versions & Cipher Suites Web Server 2. ServerHello Selects TLS Parameters 3. Sends Certificate Chain Server Certificate + Intermediate CA Certificate(s) 4. Validate Certificate ✓ Trusted Root / Intermediate CA Chain ✓ Hostname Matches Requested Website ✓ Certificate Within Validity Period ✓ Revocation Checks (if performed) ✓ Key Usage and Other Security Checks 5. Key Exchange 6. Finished Messages Secure TLS Session Established Encrypted Application Communication

This is a simplified explanation of the process. TLS 1.3 has a specific handshake sequence and uses ephemeral key exchange to establish shared session keys.

13. How to Configure an SSL/TLS Certificate in ASP.NET Core?

For an ASP.NET Core application, HTTPS can be configured using Kestrel or the hosting platform.

Example: Configure Kestrel with a PFX Certificate

For a controlled development environment, a PFX certificate can be configured in appsettings.json:

{
  "Kestrel": {
    "Endpoints": {
      "Https": {
        "Url": "https://localhost:5001",
        "Certificate": {
          "Path": "certificates/localhost.pfx",
          "Password": "YOUR_CERTIFICATE_PASSWORD"
        }
      }
    }
  }
}

In production, do not commit the PFX file or its password to source control. Prefer platform-managed certificates or secure certificate storage and access controls.

Enable HTTPS Redirection

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
var app = builder.Build();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

Note: UseHttpsRedirection redirects HTTP requests to HTTPS. It does not create or issue a certificate. The hosting endpoint must already have a valid certificate configured.

14. How to Create and Manage Certificates in Azure Key Vault?

Azure Key Vault can create, store, and manage certificates.

It supports certificate policies, certificate lifecycle management, and integration with supported Certificate Authorities.

Step 1: Create a Key Vault

  1. Open the Azure Portal.
  2. Search for Key Vaults.
  3. Select Create.
  4. Choose the subscription and resource group.
  5. Enter the Key Vault name and region.
  6. Configure permissions and networking.
  7. Select Review + Create.

Step 2: Open Certificates

  1. Open the created Key Vault.
  2. Select Certificates.
  3. Select Generate/Import.
  4. Enter a certificate name.

Step 3: Select Certificate Creation Method

Azure Key Vault supports different certificate creation approaches, including:

  • Generate: Key Vault generates the key pair and creates a certificate request according to the selected policy.
  • Import: Import an existing certificate, commonly as a PFX or PEM file.

For a certificate issued by a supported CA, configure the issuer and certificate policy as required.

Step 4: Configure Certificate Policy

Configure the required certificate properties, such as:

  • Subject and DNS names.
  • Key type and key size.
  • Key usage and extended key usage.
  • Certificate validity period.
  • Renewal and lifetime actions.

Step 5: Complete Certificate Issuance

If an external CA is configured, Key Vault can create the certificate request and coordinate with the CA. The CA issues the certificate, and Key Vault completes the certificate creation process.

If using a self-signed certificate policy, Key Vault creates a self-signed certificate instead. Such a certificate is not automatically trusted by public browsers.

Step 6: Access the Certificate

Applications can access certificates from Key Vault using appropriate authentication and permissions, such as Managed Identity and Azure RBAC.

Use the appropriate certificate and private-key access model for your application. Do not unnecessarily export private keys.

15. Certificate Renewal and Expiration

Every certificate has a validity period.

When the certificate approaches expiration, it must be renewed or replaced.

A typical renewal process is:

  1. Monitor the certificate's expiration date.
  2. Generate a renewal request or initiate renewal through the certificate management service.
  3. Complete any required domain validation.
  4. Obtain the renewed certificate.
  5. Deploy the renewed certificate to the server or hosting platform.
  6. Verify that the new certificate is being served correctly.

Azure Key Vault supports certificate lifetime actions and renewal workflows for supported issuers.

16. Best Practices

  1. Use TLS 1.2 or TLS 1.3; avoid obsolete SSL and TLS versions.
  2. Use certificates issued by trusted Certificate Authorities for public websites.
  3. Keep private keys secure and restrict access.
  4. Use Subject Alternative Names for all required DNS names.
  5. Monitor certificate expiration dates.
  6. Automate renewal and deployment where possible.
  7. Configure the complete certificate chain.
  8. Use strong, modern cryptographic algorithms.
  9. Use Azure Key Vault or an appropriate certificate-management service.
  10. Validate certificates after deployment.

17. Common Mistakes to Avoid

Mistake Correct Approach
Using an expired certificate Monitor expiration and renew before expiry.
Exposing the private key Store it securely and restrict access.
Using a self-signed certificate for a public website Use a certificate trusted by public browsers.
Missing intermediate certificates Configure the required certificate chain.
Hostname does not match certificate SAN Include the required DNS names in the certificate.
Assuming HTTPS redirection creates a certificate Configure a valid certificate on the HTTPS endpoint.
Not renewing certificates automatically Use monitoring and automated renewal where supported.

18. Important Interview Questions

Q1. What is an SSL/TLS certificate?

A digital certificate that binds an entity's identity to a public key and helps establish authenticated, encrypted communication.

Q2. What is the difference between SSL and TLS?

SSL is the older security protocol. TLS is its modern replacement and is used for secure HTTPS communication.

Q3. What is X.509?

X.509 is a standard that defines the format and structure of public-key certificates.

Q4. What is a Certificate Authority?

A Certificate Authority is a trusted organization that validates certificate requests and digitally signs certificates.

Q5. What is a CSR?

A Certificate Signing Request is a request containing the public key and identity information submitted to a Certificate Authority for certificate issuance.

Q6. Does a certificate contain the private key?

No. A public X.509 certificate contains the public key. The corresponding private key must be stored securely by its owner.

Q7. What is a self-signed certificate?

A certificate signed by its own private key rather than by a trusted external Certificate Authority.

Q8. What is a certificate chain?

A chain of certificates connecting a website certificate through intermediate certificates to a trusted root CA.

Q9. What is a wildcard certificate?

A certificate that covers a domain and matching first-level subdomains, such as *.example.com.

Q10. What happens when a TLS certificate expires?

Clients will generally report a certificate validity error and may refuse to establish a secure connection.

Q11. What is the difference between a .cer and a .pfx file?

A .cer file commonly contains the public certificate. A .pfx file can contain the certificate, private key, and certificate chain.

Q12. Does Azure Key Vault create SSL/TLS certificates?

Yes. Azure Key Vault can generate self-signed certificates or coordinate certificate issuance with supported Certificate Authorities. It can also import existing certificates.

19. Official Documentation

Conclusion

An SSL/TLS certificate is an X.509 digital certificate that connects a website's identity with its public key.

The website owner or administrator generally generates the key pair and CSR. A trusted Certificate Authority validates the request and issues the signed certificate.

For production applications, use a trusted CA, protect private keys, configure HTTPS correctly, and automate certificate renewal wherever possible.

🔙
Managed Identity vs Client Secret :👈 👉:SHA-256 with RSA