SQL Server encrypting data - sql

I have been asked to produce a system that is the middle point in a bunch of systems that handles payments to a small group or people. For it I will be required to store the peoples bank details.
What is a good way of encrypting this data to be stored within the database and then decrypt the data when required to pass onto the next system?
For this project I need to use Microsoft SQL Server.

If you're using SQL Server 2008 the you can use the built in transparent data encryption (TDE). Check out and see if it fits the bill.

I encrypt the values at application level along with an encryption key, and then pass this encrypted value to SQL Server.
When decrypting I pass the encrypted values to the application, and decrypt before using them within the application.
I prefer this method as it keeps the encryption method seperate from SQL Server.
Otherwise, if a user was to hack into your SQL Server, including your encrypted values, and you were using a T-SQL User Defined Function, they would have the ability to decrypt the values, making the encryption worthless.

Related

SQL Server Always Encrypted Limitation

I'm trying to add always encrypted to my DB table. But its not allowed to add. I can't select any encryption type. Is there any reason. I'm using SQL Server 2016.
You might have missed previous steps before adding this to a specific column.
Perhaps you need to generate the keys to be used or setting up encryption settings. (Always Encrypted definition)
You might use the ALways Encrypted Wizard

Can an admin see encrypted data with SQL Server 2016 always encrypted feature?

This looks a very nice feature, but what I understood its that only the app can see the unencrypted text of the columns, right?
Is it possible that the admin with a SQL query can see the unencrypted data? or does it have to be always from the app?
If yes, can you post a small query to show this
The answer is NO you cannot see encrypted data even if you are the data admin. The admin should not have access to Column Master Key (certificate). You can access it from a client machine that has certificate installed using SSMS or .Net application. Please check the MSDN blog
The new security layer addresses that vulnerability by keeping the
data encrypted even during transactions and computations, and by only
giving the client keys to decrypt it. That means that if anyone else,
including a database or system administrator, tries to access that
client’s database, the credit card information or other sensitive data
would just look like gibberish.
If you are an admin/DBA you can access plaintext data, if you have access to the column master key. To select and decrypt data, you can use any version of SSMS that supports Always Encrypted. Starting with SSMS 17.0, you can also insert, update, and filter by encrypted columns. For more details, please see:
https://msdn.microsoft.com/en-us/library/mt757096.aspx#Anchor_1
https://blogs.msdn.microsoft.com/sqlsecurity/2016/12/13/parameterization-for-always-encrypted-using-ssms-to-insert-into-update-and-filter-by-encrypted-columns/

storing highly sensitive data in sql server

I've been looking for finding the best solution to store highly sensitive information like an Amount or a balance in a banking application. Can I store that just as a numeric field or Do I need any encryption to encrypt that data? Am a bit worried about encryptions since these fields are frequently being accessed by the users. So when ever it gets accessed there needs to be some decryption mecahnism and to store back the new balance amount that again needs some encryption.
Or is there is a better solution for that.
Database is SQL Server 2008 R2 and the platform is .NET 4.0
This is an important topic to think about, there are lots of ways to do it.
However encryption in the best possible way when we have confidential data and to save things from Hackers you should surely encrypt it.
Take a look at this
http://msdn.microsoft.com/en-us/library/ms179331.aspx
and this
http://msdn.microsoft.com/en-us/library/ms174361.aspx
You should not need to store the data in an encrypted manner.
When it comes to security of data you should always work on preventing access via firewalls and correct login protocols.
Also only allows users to access data for which they have clearance.
When it comes to encryption - you could encrypt the disk but encrypting columns is not really worth the access time it will take in decrypting the data and if someone has access to the database invariably they will have access to the decryption routines.

Encryption of entire database or selected tables

I m bit new to this field of DBA i wanted to know is there any codes available to encrypt the entire database as we have a huge database maintained in sqlserver 2005 .
I know that it is not safe to encrypt the entire database but we ha such kind of requirement moreover the in the application end they don't want to encrypt it.
i want the process to be as the data comes through the application end into the database it should be encrypted and stored and while retrieving the data it must be decrypted with a certificate/key as provided and shown. I don't want to use any 3rd party tools as it has been instructed.
i searched through the net and found that we can encrypt columns and stored procedure through asymmetric/symmetric key but i need to encrypt the entire database(selected tables is also ok) can you all help me in that.
I don't think there is an easy way to do it in 2005, you would need to redefine all (or most) of your tables to take encrypted data (varbinary) and then you'd lose the ability to do searches and comparisions and a whole heap of other stuff.
For 2008 there is Transparent Data(base) Encryption, which encrypts at the file level (when SQL server writes data) no changes required to your applications.
Search for SQL Server TDE and have a look around.

Best practices for dealing with encrypted data in MSSQL

I have some data in my user database that I would prefer to be encrypted. Most of the data will need to be decrypted when requested, but there are also passwords that can stay encrypted (in the old days we would use pwdcompare but I believe this is obsolete now).
I have followed the steps here, so I have now successfully encrypted my data.
What I don't understand is the correct way to open the master key at runtime, in order to encrypt/decrypt data. If I want to use stored procedures to retrieve encrypted data, how do I go about opening the master key? Do I pass in the master key's password using a stored proc parameter?
As I have understood, you should create master key once (you can do this during installation process) and this is the first and last time password is needed. After that, using master key create encryption key (symmetric or asymmetric) without a password and use it to encrypt/decrypt your data. You don't have to give a password for it, all you need is use your encryption key and have CONTROL permission on it. The only issue is that your DBA can have it too :)
See this article: Using Asymmetric Encryption and Digital Signatures in a SQL Server 2005 Database