I have considered TDE and cell level encryption mechanism for securing my database, however these two cannot fully satisfy my requirements.
I've found that PGP may help me, but it is mainly used for mail services.
What is the technical feasibility for implementing PGP for my SQL server database, is there any possibilities for that?
TDE does not satisfy my requirements because it only protects data-at-rest. I need to protect the data from an attacker who has access to the database while it is running on the server containing the encryption certificate, as well as the data contained within backups.
I'd also like to have some users able to see the decrypted values, while some other users cannot ever see the decrypted values.
- I have implemented master-slave Replication, and need to enable security without affecting the replication.
- Approximately 80% of coding has been completed, so its really hard to change the queries and stored procedures.
- I need to enable security for selected tables only (payments, customer details, password, etc.)
- I need to secure data from injection.
Best Answer
SQL Server has several built-in possibilities to secure data on a columnar basis.
ENCRYPTBYPASSPHRASE
- use this to encrypt data with a passphrase using the TRIPLE DES algorithm with a 128 key bit length.ENCRYPTBYKEY
- use this to encrypt the data with a key stored in themaster
database. Without access to the key, the data cannot be recovered.Take the following example using
ENCRYPTBYPASSPHRASE
andDECRYPTBYPASSPHRASE
:This shows the encrypted data held in the row:
The encrypted row:
This shows how to display decrypted data:
The decrypted row:
The
SomeSalt
column is a pseudo-randomly-generated value used to guard against whole-value-substitution attacks, and provides significant protection against rainbow-table attacks. Whole-value-substitution attacks consist of copying the encrypted value from one row to another row in order to bypass the need to know the encryption passphrase.