---
title: TLS Encryption For All Connections (Database)
impact: CRITICAL
impactDescription: protects data in transit from interception
tags: tls, encryption, https, transport, security, csharp
---

## TLS Encryption For All Connections (Database)

Database connections must be encrypted.

**Incorrect (unencrypted connection string):**

```
Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
```

**Correct (encrypted):**

```
// SQL Server
Server=myServerAddress;...;Encrypt=True;TrustServerCertificate=False;

// PostgreSQL (Npgsql)
Server=...;SSL Mode=Require;
```

**Tools:** Connection String validation
