How to Fix SQL Server Error 33128 (Msg 33128)
You get sql server error 33128 when an encryption task uses an old key algorithm. You can fix it by creating a new key with a modern algorithm. This failure returns message 33128 with a severity level of 16. The database engine blocks the encryption step because the current compatibility level drops old ciphers. Teams often see this alert after upgrading a database or raising its compatibility level. Existing keys might still decrypt old rows, but new write operations will fail right away. Wh
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You get sql server error 33128 when an encryption task uses an old key algorithm. You can fix it by creating a new key with a modern algorithm.
This failure returns message 33128 with a severity level of 16. The database engine blocks the encryption step because the current compatibility level drops old ciphers. Teams often see this alert after upgrading a database or raising its compatibility level. Existing keys might still decrypt old rows, but new write operations will fail right away.
Why sql server error 33128 happens in the database engine
The database engine enforces strict security rules at newer compatibility levels. When an app tries to encrypt data, the engine checks the key algorithm first. If the key uses a deprecated algorithm, the engine stops the query and throws message 33128.
Older databases often hold symmetric or asymmetric keys created many years ago. Those keys stayed valid while the database ran at an older compatibility level. Once an admin raises that level, the engine blocks new encryption calls with those keys. The official error message states that the algorithm is no longer supported at this level.
This issue does not mean your network path or client driver failed. Severity 16 means the error comes from user rules or database objects that need updates. Your existing data stays safe, and the engine can still read older encrypted values. Only new encryption requests using the retired cipher will fail during query runs.
How to diagnose and fix deprecated encryption keys
Start by finding which key triggered the failure in your query or stored procedure. Check the database catalog views to see every key and its algorithm type. Look for keys that rely on legacy ciphers that your current level rejects.
Do not lower the database compatibility level just to bypass this security check. Lowering the level hides the problem and keeps weak encryption active in production. Instead, plan a safe key rotation during a quiet window for your app.
Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
First, create a new key in the database using a supported modern algorithm. Next, open the old key to decrypt the sensitive column values in batches. Right away, encrypt those values again using the newly created key. Once all rows use the new key, update your app scripts to point to it. Finally, drop the deprecated key so no script can call it by mistake.
Keeping access safe during key rotation
Rotating keys touches sensitive fields like card numbers, phone numbers, or national IDs. Many teams make the mistake of giving engineers broad owner rights during a fix. In SQL Server, the fixed owner role can change all settings and even drop the database.
Instead, keep roles tight when your team investigates message 33128 in production. A database user is the identity of a login when it connects to a database. For people who need access to one database, a contained user is an option. For read checks, use the fixed data reader role to view user tables and views. Grant key management permissions only to the specific role running the rotation script. Also, use data masking so queries rewrite matched fields like emails or card numbers in results.
Add runtime guardrails beside SQL Server
Role grants and network rules are needed setup for SQL Server. Still, an allowed user or agent tool can send a bad delete or read raw customer fields over a valid session. In practice, hoop.dev sits inline in the TDS protocol beside the database as a sidecar for your SQL Server. For every query an agent or human runs in production, hoop.dev decides whether to pass, mask, block, or escalate it for review.
With hoop.dev SQL Server controls, rules refuse banned statements before they run, hold risky queries for human review, and mask matched sensitive values in supported result columns in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for HIPAA, PCI DSS, SOX, and GDPR audits. See the source on GitHub.
Frequently asked questions
What does severity 16 mean for message 33128?
Severity 16 means the error is a general problem that the user can fix. The database engine stays online, and only the query using the old key fails.
Should I lower the database compatibility level to fix this error?
No, lowering the level weakens security and blocks new query engine features. The right fix is to create a new key with a supported algorithm and re-encrypt data.
Can I still read data encrypted with the old key?
Yes, the engine blocks new encryption calls, but you can still open the old key. This lets you decrypt existing data and move it to a new key safely.
Related guides
In this post