Popular SQL Server Database Encryption Choices: Sourav Mukherjee
Popular SQL Server Database Encryption Choices: Sourav Mukherjee
Fig 1: Transparent Data Encryption Process [2] • In Always Encrypted the data is encrypted both at
rest and in the memory and where the decryption
Basically, if you want your database backup to be pro- logic is defined at the Client side and it is done by
tected then TDE works v well. If you implement TDE Client Driver. This signifies that one can shield
in the source server and if you want to restore data- the data from harmful threats (by admins and by
base to another server then you need a master key, the man sitting in the middle to attack).
certificate to restore. Think about how you open your • Whereas Transparent Data Encryption (TDE) can
locker in the bank. One key is with you and the other only offer encryption at rest and that means not
key is with the ban professional to implement an extra fully secured.
layer on protection.
However, there are some limitations to the implemen-
On the other hand, the Always Encrypted (AE) pro- tation of Always Encrypted.
vides transparent encryption from the database to cli-
ent applications. This AE feature is improved upon
• It can be just a single column which is so far for
TDE by providing extra layer of encryption of sensi-
AE.
tive data in memory and in transit, as well as at rest.
The Always Encrypted-enabled driver actually per- • To implement this feature, modification of the
forms the encryption and the decryption of the appli- existing applications may be required.
cation. The owner of the information can then govern • You can’t involve tempdb to include part of AE
any potential leakage to database administrators by • Columns that are using one of the subsequent
preserving the decryption keys so that administrators datatypes such as: xml, timestamp, rowversion,
do not have incidental access to sensitive data. By image, ntext, text, sql_variant, geography, hierar-
contrast, the database administrator has access to the chyid, alias, geometry, user defined-types, etc.
encryption keys with TDE by using the master key • Some of the encrypted data types may require a
and the certificates. “_bin2” collation type, which may require few
DDL code changes.
The below diagram shows that how the Always En- • Your application will need to be compatible
crypted process typically works. with .NET 4.6. If not, may not work.
• The application administrator will need to fully
understand the encryption keys to ensure that they
are protected—both from the
• Database administrators and other unintended designated users. It has few simple masking functions
audiences. which are either inbuilt or you can customize based on
• The encryption keys will also need to be backed your own need and through that you can prevent users
up for disaster recovery. to few unmasked data.
• Adding AE may increase your database size and
CPU usage (especially for database writes) and The beauty of this feature is that it does not require
adding encryption may also prevent any dedupli- any coding effort from the application side or encrypt-
cation algorithms. ing or applying any change to the real data stored in
• Some of the SQL Server features such as replica- the disk.
tion are not currently supported in all editions. In-
stead you might have to upgrade to costlier Enter-
prise Edition.
For example, you may want to use Always Encrypted There are four masking function in which are used to
to send data from a SQL Server database which is mask the data:
hosted internally to a web-based SQL Server database
and application. The data will be safe guarded in the • Default
transition and will be encrypted in the database. If
your web application does basic SQL queries at the • Random
database layer, this method can work well.
• Custom String
[ChangedDate] [datetime] MASKED WITH (FUNC-
• Email TION = 'default()') NULL
)
Code Snippet to be used to Implement Dynamic
Data Masking using SQL Server T SQL (Edition
SQL 2016 and onwards) --3 Insert Records to the table.
Insert Into [dbo].[EmployeeContacts] values ('Sourav',
--1 Create the Database 'Mukherjee', '1234-3026-4508-4325',
USE [master] 10000,'smukherjee3818@ucumberlands.edu',
GO 'smukherjee3818@ucumberlands.edu','2018-12-30
CREATE DATABASE [DynamicDataMaskingDemo] 08:00:00')
CONTAINMENT = NONE
ON PRIMARY --4 Grant permission to the user to the table.
( NAME = N'DDM', FILENAME = N'C:\Program CREATE USER [ReadOnlyTestUser] WITHOUT
Files\Microsoft SQL Serv- LOGIN;
er\MSSQL14.MSSQLSERVER\MSSQL\DATA\DD GRANT SELECT ON [EmployeeContacts] TO
M.mdf' , SIZE = 8192KB , MAXSIZE = UNLIM- [ReadOnlyTestUser];
ITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'DDM_log', FILENAME = --5 Check table records (with super user permis-
N'C:\Program Files\Microsoft SQL Serv- sion)
er\MSSQL14.MSSQLSERVER\MSSQL\DATA\DD select * from [DynamicDataMasking-
M_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , Demo].[dbo].[EmployeeContacts];
FILEGROWTH = 65536KB )
GO
--6 Check the record using the user permission.
--2 Create your table with proper functions Execute as USer = 'ReadOnlyTestUser';
Use [DynamicDataMaskingDemo] select * from [DynamicDataMasking-
GO Demo].[dbo].[EmployeeContacts];
CREATE TABLE [dbo].[EmployeeContacts] Revert
( --This section will apply the masking function.
[ID] [int] IDENTITY(1,1) NOT NULL Pri-
mary key, Observation:
[FName] [nvarchar](30) MASKED WITH • The data will be masked for the user ReadOn-
(FUNCTION = 'default()') NOT NULL, lyTestUser. Check out Fig #4 below about before
[LName] [nvarchar](30) NOT NULL, masking vs after masking results.
[CreditCard] [varchar](20) MASKED WITH
(FUNCTION = 'partial(2, "XX-XXXX-XXXX-XX", Conclusion:
2)') NULL, • This method allows developer to debug the Pro-
[SalaryUSD] [int] MASKED WITH duction environment without breaking the securi-
(FUNCTION = 'default()') NULL, ty or privacy for a user.
[OfficalEmail] [nvarchar](100) MASKED
WITH (FUNCTION = 'email()') NULL,
[PersonalEmail] [nvarchar](100) MASKED
WITH (FUNCTION = 'email()') NULL,
Dynamic Data Masking also comes with its to encrypt data stored in all types of databases either it
own limitations: is structured or unstructured kind and at the file and
folder levels which does not require any underlying
A masking rule cannot be defined for the following changes to the databases or at the application level.
column types:
The Vormetric Transparent Encryption software has
• Columns with already defined encryption such as an agent which runs on servers or at the VM level to
Always Encrypted control access to files, folders and volumes. It finally
reports the activities to DSM. The DSM is a physical
• Associated with FILESTREAM or a virtual application which provides a Web-based
user interface which can manage the complete plat-
• It cannot be configured on a computed column. form. Agents can also apply the policies which are
However, if the computed column is dependent defined in the DSM to regulate the user actions, such
on a column with a MASK, then it will return the as limiting which user can access the encryption key
masked data. and for what purpose they can use it. The administra-
tors can use the DSM to monitor the databases and
• It can’t be a part of Full Text Index systems. They can also view current status, or they can
manage the encryption keys, or they can also govern
• It can’t be performed on a column with any de-
access privileges.
pendency. As a workaround, remove the depend-
ency first and then add DDM and finally recreate
Customers rely on Vormetric application encryption
the dependency. Let’s say if the dependency is on
for several key reasons. By encrypting data in the ap-
a column in an index, then drop the index first
plication server, it is secured while in transit and in
then apply the mask and finally recreate the de-
storage. Data is protected across its lifecycle including
pendent index.
when it is backed up, migrated and archived. The solu-
tion insures that administrators and others with system
The final topic of discussion here is on Vormetric
and infrastructure access can't access sensitive data
Transparent Encryption. Not sure how many of you
and application encryption can reduce the scope of
got a chance to work using Vormetric but it offers
PCI DSS compliance.
many cool features.
Very importantly if encrypted data is stolen attackers
• Vormetric is specialized for enterprise level en- won't have any means to decrypt the data, so it won't
cryption and for key management to protect da- be of any use or value even if a SQL injection attack is
tabases which are in physical, virtual and Cloud successful at extracting data from a compromised
Environments. This solution delivers compre- server only encrypted data will be returned to the
hensive capabilities that enable your organiza- hacker which won't be of any value and finally it pro-
tion to address a broad range of security objec- tects from insider threats. Even your administrators
tives. It also simplifies implementation and man- won't be able to see sensitive.
agement for metric enables organizations to se-
cure data across all their environments including II. CONCLUSIONS
physical virtual cloud and big data. The Data Se-
curity Platform contains encryption, the key Every IT and security group are under growing pres-
management, key vault and toolkit products sure as they continue to have more sensitive data to
which are all managed via the Vormetric Data protect, more threats to combat and more compliance
Security Manager also known as DSM. Vormet- mandates to address. One of the best ways to contend
ric's Transparent Encryption module is an agent with these
which runs at the file system level on a server
that encrypts data at rest. It is also used to access increasing security demands is to encrypt sensitive
control, and for collecting security logs. data. Recent research has revealed that how the adop-
tion of encryption has increased as has the number of
• It is often employed for compliance especially objectives it is being used to address the most com-
for protecting credit cards, medical records, per- mon reasons for employing encryption.
sonal information and intellectual property.
In addition, encryption is being used to safeguard an
Vormetric Product features organization's reputation.
Vormetric distinguishes itself from the competitors by Finally, security breaches have become a near certain-
providing transparent encryption, access controls that ty for most organizations now. Security managers
too at the granular levels and security intelligence. It started realizing that encryption can mitigate the dam-
also offers cloud platform support. It has the capability age that these attacks inflict to address. It is believed
that more than thirty five percent of organizations
ISSN: 2231 – 2803 www.internationaljournalssrg.org Page 5
SSRG International Journal of Computer Science and Engineering (SSRG-IJCSE) – Volume X Issue Y–Month 2018
have instituted a consistent encryption strategy. How- Security, AI and Machine Learning. He is an MCT
ever, as the use of encryption has grown so has the (Microsoft Certified Trainer) since 2017 and holds
number of encryption solutions that have been sup- other premier certifications such as MCP, MCTS,
ported in fact more than seventy percent of organiza- MCDBA, MCITP, TOGAF, Prince2, Certified Scrum
tions are working with five or more encryption tech- Master and ITIL
nologies.
REFERENCES
[1] Microsoft TechNet blog post, Always Encrypted (Database
Engine) - SQL Server | Microsoft Docs
[https://social.technet.microsoft.com/wiki/contents/articles/37
979.working-with-the-always-encrypted-feature-in-sql-server-
2016.aspx]
AUTHOR’S PROFILE
Sourav Mukherjee is a Senior Database Administrator
and Data Architect based out of Chicago. He has more
than 12 years of experience working with Microsoft
SQL Server Database Platform. His work focusses in
Microsoft SQL Server started with SQL Server 2000.
Being a consultant architect, he has worked with dif-
ferent Chicago based clients. He has helped many
companies in designing and maintaining their high
availability solutions, developing and designing ap-
propriate security models and providing query tuning
guidelines to improve the overall SQL Server health,
performance and simplifying the automation needs.
He is passionate about SQL Server Database and the
related community and contributing to articles in dif-
ferent SQL Server Public sites and Forums helping the
community members. He holds a bachelor's degree in
Computer Science & Engineering followed by a mas-
ter’s degree in Project Management. Currently pursu-
ing Ph.D. In Information Technology from the Uni-
versity of the Cumberlands. His areas of research in-
terest include RDBMS, distributed database, Cloud