Security. This word is so important when it comes to data, and there is a reason why. Every business has it’s vital data, and this data has to be accessed only by those who are authorized. Back in 2009, I wrote an article on what measures to take when it comes to securing SQL Server.
There were days when we used to have a third party tool to encrypt the data inside SQL Server. Later, Microsoft introduced Transparent Data Encryption (TDE) bundled with the release of SQL Server 2008. You may be wondering why it is so important to encrypt the data. Inside our database, there may be a case that the customer/application has to enter and store the sensitive information such as Social Security Number (SSN) or Financial/Payment Data, which should not be read in plain text, even by a DBA. With this requirement, a strong encryption and/or data masking comes into the picture.
With the launch of SQL Server 2016 Release Candidate 0 (RC0) , Microsoft has introduced two new features that are my personal favorite – 1) Always Encrypted and 2) Dynamic Data Masking. Today I am going to walk you through the Always Encrypted feature.
First and foremost, we need to have SQL Server 2016 RC0 installed so that we can test this feature. You can download the RC0 here. Once you are ready with RC0, create a test database and a table with an Encrypted column to store the sensitive data. There are few prerequisites that I will list for you here. If you want, you can use the sample schema from MS.
- Create a sample database
- Create Column Master Key
- Generate a self-signed certificate (well, you will need to install this certificate on the machine where the application will run)
- Configure Column Encryption Key
- Create a test table with Always Encrypted column
- Create an application to Insert data into the sample table we created in previous step
I have created a sample app and a demo script for the reference which you can download here. Basically, what we have to remember is that we can not insert the value inside the Always Encrypted table directly, we will need to use the tool/app, and the data will always be encrypted when it goes inside the database. This will ensure that the intruder can not get the data as it travels to the database in a cipher text form.
Here is some further reading on this topic. Enjoy reading and testing an excellent feature of SQL Server 2016 RC0.
- Always Encrypted: SQL Server 2016 includes new advances that keep data safer
- Getting Started With Always Encrypted
- TSQL Tuesday #69 : Always Encrypted Limitations
Interested in working with Hemantgiri? Schedule a tech call.