You are on page 1of 32

ENCRYPTION &

KEY MANAGEMENT
FOR SQL SERVER
THE DEFINITIVE GUIDE

In 2008 the Payment Card Industry Data Security Standard (PCI-
DSS) was gaining serious traction and Microsoft released SQL Server
2008 with built-in support for encryption. This was no coincidence.
In addition to the PCI standard which mandated encryption of credit
card numbers, numerous states in the US had also adopted data
breach notification laws with strong recommendations for encryption.
The compliance environment was changing dramatically and the
SQL Server group at Microsoft provided a path to meet those new
compliance regulations. This was a prescient and crucially important
enhancement for Microsoft customers - the security threats have
increased over time and compliance regulations have become more
stringent.

This eBook will discuss how Microsoft implemented encryption in SQL


Server, how you can leverage this capability to achieve better security
and compliance, and the critical issues involved in getting encryption


right with SQL Server.

Patrick Townsend, Founder & CEO,


Townsend Security

Page 2
CONTENTS
Introduction 4

Transparent Data Encryption 7

Cell Level Encryption 9

Encryption Key Management 11

EKM Provider Implementation 13

Business Continuity 16

Key Management Best Practices 19

Key Management Standards 23

Platform Support 26

Vendor Considerations 29

Page 3
INTRODUCTION

ARCHITECTURE
Many Microsoft applications and services implement
a “Provider” interface. This is the term that Microsoft
uses to describe a standardardized, pluggable
architecture for third party software companies to
integrate and extend the capabilities of Microsoft
solutions. With Provider architectures Microsoft
enables a method for third parties to register their
software to the Microsoft application, and the
Microsoft application will then call that software
as needed. The third party software must obey
rules about the data interface and behavior of
their applications. If done correctly the Provider
interface provides powerful extensions to Microsoft
applications. Every version of SQL Server since 2008 has fully
implemented the EKM Provider architecture. This
Starting with SQL Server 2008 the database has provided a stable and predictable interface for
implements a Provider interface for encryption and Microsoft customers and key management vendors.
key management. This is named the “Extensible
Key Management” Provider interface, or the “EKM EKM Architecture - column and database encryption
Provider”. EKM Provider software performs encryption The EKM Provider architecture supports two different
and key management tasks as an extension to the methods of database encryption:
SQL Server database. The EKM Provider architecture • Cell Level Encryption
opened the door for third party key management • Transparent Database Encryption
vendors to extend encryption to include proper
encryption key management. Cell level encryption is also known as column level
encryption. As its name implies it encrypts data in a
From a high level point of view the EKM architecture column in a table. When a new row is inserted into
looks like this: a table, or when a column in a row is updated, the
SQL Server database calls the EKM Provider software
to perform encryption. When a column is retrieved

Page 4
INTRODUCTION (CONT)

from the database through a SQL SELECT or other encryption control. The activation of the EKM Provider
statement the EKM Provider software is called to software causes the database to be immediately
perform decryption. The EKM Provider software is encrypted and all further data operations on the
responsible for both encryption and key management database will invoke the EKM Provider software.
activity. Implementing cell level encryption requires
minor changes to the SQL column definition. MICROSOFT EKM PROVIDER FOR
LOCALLY STORED ENCRYPTION
Transparent Database Encryption,
or TDE, provides encryption
KEYS
Recognizing that some SQL Server customers wanted
for the entire database and
to encrypt data but did not have the resources or
associated log files. All tables
time to implement a key management solution,
and views in the database are
Microsoft provided a built-in EKM Provider that
fully encrypted. Data is encrypted
performs encryption but which stores encryption keys
and decrypted as information
locally in the SQL Server context. Understanding
is inserted, updated, and retrieved by users and
that this was not a security best practice, Microsoft
applications. As its name implies, transparent data
recommends that customers use a proper encryption
encryption requires no changes to applications, SQL
key management solution that separates encryption
definitions, or queries. The database works seamlessly
keys from the SQL Server database. That was good
after encryption is enabled.
advice - locally stored encryption keys can be
recovered by cyber criminals and the use of external
Transparent Data Encryption is the easiest of the two
key management systems provides better security
encryption methods to implement. Later, I will discuss
and compliance.
when it makes sense to use TDE and when Cell Level
Encryption is a better choice.
EKM PROVIDER SOFTWARE
EKM Provider software is usually provided by your
ACTIVATING THE EKM PROVIDER encryption key management vendor. This means
After installing the EKM Provider software from a third
that the features and functions of the EKM Provider
party, the SQL Server database administrator uses the
software can vary a great deal from one vendor
SQL Server management console to activate the EKM
to another. Be sure that you fully understand the
Provider and place the database or columns under
architecture and capabilities of the EKM Provider
before you deploy SQL Server encryption.

Page 5
INTRODUCTION (CONT)

SQL SERVER VERSIONS THAT


SUPPORT EKM
EKM Provider support is available in all Enterprise WHITE PAPER:
editions of SQL Server including Data Warehouse and Encryption & Key Management
Business Intelligence editions, as well as SQL Server for Microsoft SQL Server
2019+ Standard Edition. EKM provider support is not
available in Standard, Web, or Express editions of SQL
Server.

“EKM Provider software


performs encrpytion and
key management tasks
as an extension to the
SQL Server database. The
EKM Provider architecture
opened the door for third
party key management
vendors to extend
encryption to include
DOWNLOAD
proper encryption key
management.”

Page 6
TRANSPARENT DATA ENCRYPTION
Most Microsoft customers who implement encryption and disadvantages to this approach - you expend
in SQL Server use Transparent Data Encryption (TDE) computing resources to encrypt data that may not be
as it is the easiest to implement. No code changes are sensitive, but you also avoid mistakes in identifying
required and enabling encryption requires just a few sensitive data. By encrypting everything at rest you
commands from the SQL Server console. Let’s look at are also protected from expansion of regulatory rules
some of the characteristics of TDE implementation. about sensitive data protection.

DATABASE ENCRYPTION PROTECTION OF THE


TDE involves the encryption of the entire database
SYMMETRIC KEY
space in SQL Server. There is no need or ability to
When you enable Transparent Data Encryption on
select which tables or views are encrypted, all tables
your SQL Server database the database generates
and views in a database are encrypted at rest (on
a symmetric encryption key and protects it using the
disk). When data is read from disk (or any non-volatile
EKM Provider software from your key management
storage) SQL Server decrypts the entire block making
vendor. The EKM Provider software sends the
the data visible to the database engine. When data
symmetric key to the key server where it is encrypted
is inserted or updated the SQL Server database
with an asymmetric key. The encrypted database
encrypts the entire block written to disk.
key is then stored locally on disk in the SQL Server
context.
With TDE all of the data in your database is encrypted.
This means that non-sensitive data is encrypted
When you start a SQL Server instance the SQL Server
as well as sensitive data. There are advantages
database calls the EKM Provider software to decrypt
the database symmetric key so that it can be used for
encryption and decryption operations. The decrypted
database key is stored in protected memory space
and used by the database. The encrypted version of
the database key remains on disk. In the event the
system terminates abnormally, the only version of the
database key is the encrypted version on disk.

Page 7
TRANSPARENT DATA ENCRYPTION (CONT)

STARTING THE SQL SERVER index of a column. An example of a SELECT statement


would be something like this:
INSTANCE
During normal operation of SQL Server there is no
SELECT Customer_Name, Customer_
invocation of the EKM Provider software and therefore
Address FROM Orders WHERE Credit_
no communication with an external key manager.
Card=’4111111111111111’;
Every normal restart of the SQL Server database
instance will cause the EKM Provider software to be
To satisfy this SQL query the database must inspect
called to unlock the database key on the key server.
every row in the table Orders. With TDE this means
It should be noted that it is the responsibility of the
that the column Credit_Card must be decrypted in
EKM Provider software to handle network or key
every row. Similar operations with the ORDERBY
server failure conditions. SQL Server itself has no
clause can cause table or index scans.
visibility on the connection to an encryption key
management solution. If the EKM Provider software
is unable to retrieve an encryption key, the SQL PERFORMANCE
Server start request will fail. We will discuss business CONSIDERATIONS
continuity issues in more detail later in this series. Transparent Data Encryption is very optimized for
encryption and decryption tasks and will perform
PROTECTING DATABASE LOGS well for the majority of database implementations.
SQL Server logs may contain sensitive data and Microsoft estimates the performance impact of TDE
therefore must also be encrypted. Transparent of 2% to 4% and we find this
Database Encryption addresses this by fully accurate for most of our customers.
encrypting database logs along with the database However, Microsoft SQL Server
itself. It is important to remember that encryption of the customers with very large SQL PERFORMANCE

logs will only start after TDE is activated AND after you Server databases should use
stop and restart the database log. If you neglect to caution when implementing TDE.
restart logging sensitive data may be exposed in the Be sure that you fully understand the impact of TDE
SQL Server log files. on your application use of large tables. It is always
recommended that you perform a proof-of-concept
project on very large databases to fully assess the
TABLE AND INDEX SCANNING
performance impact of encryption.
Certain SQL operations on indexes require that the
SQL Server database have visibility on the entire

Page 8
CELL LEVEL ENCRYPTION
Cell Level Encryption, or CLE, is Microsoft terminology impacts on your SQL Server database. Because the
for Column Level Encryption. With CLE the manner EKM Provider is only called when the column must
and timing of SQL Server’s call to the EKM Provider be encrypted or decrypted, you can reduce the
software is quite different than for Transparent encryption overhead with careful implementation of
Data Encryption. It is important to understand these your database application code. If a SQL query does
differences in order to know when to use CLE or TDE. not reference an encrypted column, the EKM Provider
Let’s look at some aspects of the CLE implementation. will not be invoked to perform decryption. As an
example, if you place the column Credit_Card under
CLE encryption control, this query will not invoke the
ENCRYPTED COLUMNS EKM Provider for decryption because the credit card
number is not returned in the query result:

SELECT Customer_Number, Customer_Name,


Customer_Address FROM Orders ORDERBY
Customer_Name;

You can see that judicious use of SQL queries may


reduce the need to encrypt and decrypt column data.

SQL APPLICATION CHANGES


Unlike Transparent Data Encryption you must make a
change to the SQL statement in order to implement
Cell Level Encryption is implemented at the column Cell Level Encryption. The SQL Server functions
level in a SQL Server table. Only the column you “encryptbykey” and “decryptbykey” are used on SQL
specify for encryption is protected with strong statements. Here is an example of a SQL query that
encryption. You can specify more than one column for decrypts a CLE-encrypted column:
CLE in your tables, but care should be taken to avoid
performance impacts of multiple column encryption. select encryptbykey(key_guid(‘my_key’), ‘Hello
Using the same encryption for multiple columns can World’);
reduce the performance impact.
Implementing CLE encryption requires application
With Cell Level Encryption you may be able to modifications, but may be well worth the addtional
minimize some of the encryption performance work.

Page 9
CELL LEVEL ENCRYPTION (CONT)

ENCRYPTION & KEY RETRIEVAL When deploying CLE it is important that the EKM
The EKM Provider software is called for each column Provider software optimize both encryption and key
value to perform encryption and decryption. This management. The number of calls to the EKM Provider
means a larger number of calls to the EKM Provider software can be quite high. Good EKM Providers will
compared to Transparent Data Encryption. Because securely cache the symmetric key in the SQL Server
the number of calls to the EKM Provider may be context rather than retrieve a key on each call. The
quite large it is important that the encryption and key retrieval of an encryption key from a key server takes
management functions of the EKM Provider are highly precious time and multiple calls to retrieve a key
optimized for performance (see the next section). can have severe performance impacts. Secure key
caching is important for CLE performance. The use of
The EKM Provider software from your key the Microsoft Windows Data Protection Application
management vendor is responsible for performing Program Interface (DPAPI) is commonly used to protect
encryption of the data. From a compliance point of cached keys.
view it is important to understand the encryption
algorithm used to protect data. Be sure that the PERFORMANCE
EKM Provider software uses a standard like the CONSIDERATIONS
Advanced Encryption Standard (AES) or other industry When properly implemented Cell Level Encryption
recognized standard for encryption. It is common to can reduce the performance impact of encryption on
use 128-bit or 256-bit AES for protecting data at rest. your SQL Server database. For very large tables with
Avoid EKM Providers which implement non-standard a small number of columns under encryption control,
encryption algorithms. the performance savings can be substantial. This is
especially true if the column is used less frequently in
your applications.
ENCRYPTION KEY CACHING

VENDOR NOTE:
Note that each vendor of EKM Provider
software implements encryption and
key management differently. Some EKM
Providers only implement Transparent
Data Encryption (TDE). If you suspect
you will need Cell Level Encryption be
sure that your key management support
includes this capability.

Page 10
ENCRYPTION KEY MANAGEMENT
The hardest part of an encryption strategy is the Data Encryption, and must handle the retrieval of a
proper management of encryption keys. Failing symmetric key for Cell Level Encryption. Key retrieval
to protect encryption keys puts protected data should be performed in a manner that protects the
at risk, and fails to meet security best practices encryption key from loss on the network, protects
and compliance regulations. For Microsoft SQL the key while in memory, and should properly log
Server customers who have already implemented the key retrieval event in a system log repository.
Transparent Data Encryption (TDE) or Cell Level Encryption key retrieval is normally protected through
Encryption (CLE) the biggest cause of an audit failure the use of a secure TLS network connection between
is the lack of good encryption key management. the EKM Provider software on SQL Server and the
key manager hardware or virtual machine. There
This is the fourth in a series on the topic of Microsoft are many other critical aspects of EKM Provider key
SQL Server encryption. Let’s look at some of the management implementations, and these will be
characteristics of good encryption key management discussed in a future series.
for SQL Server.
KEY MANAGEMENT INDUSTRY
EXTENSIBLE KEY MANAGEMENT STANDARDS
Encryption key management systems are
(EKM) PROVIDERS
cryptographic modules that perform a variety of
As we’ve discussed previously it is the responsibility
functions. As a cryptographic module they fall under
of key management vendors to provide the Extensible
the standards of the National Institute of Standards
Key Management (EKM) Provider software that is
installed and registered to the SQL Server database and Technology (NIST) and key managers should
provably meet NIST standards. The relevant NIST
enabling either TDE or CLE encryption. The software
standard for encryption key management is the
from the key management vendor is installed on the
Federal Information Processing Standard 140-2 (FIPS
SQL Server instance and provides both encryption
140-2), “Security Requirements for Cryptographic
and key management services. The SQL Server
Modules”. Key management solutions which
database administrator does not need to be involved
implement FIPS 140-2 standards will insure the
in the actual retrieval of an encryption key - that is the
generation of strong encryption keys, the protection
job of the EKM Provider software.
of those keys from corruption or substitution, and the
implementation of encryption that provably meets
EKM Provider software must handle the encryption
NIST cryptographic standards.
and decryption of the database key for Transparent

Page 11
ENCRYPTION KEY MANAGEMENT (CONT)

In addition to provide standards for encryption key under the protection of the key manager. The EKM
management NIST also provides a method for vendors Provider software of your vendor then becomes
to validate that their solutions meet the standard. responsible for unlocking the database key (TDE) or
Encryption key management solutions are tested by retrieving the symmetric key for Cell Level Encryption
chartered security testing laboratories and solutions (CLE).
are then approved directly by NIST. NIST publishes
the solutions that have passed FIPS 140-2 testing and
Microsoft SQL Server customers should look for FIPS
OASIS KEY MANAGEMENT
140-2 validation of any key management solution INTEROPERABILITY PROTOCOL
used to protect the database. Provider software on (KMIP)
SQL Server and the key manager hardware or virtual Many SQL Server customers ask about the KMIP
machine. There are many other critical aspects of EKM standard for integrating with key managers. While
Provider key management implementations, and these KMIP is important for many reasons, it does not apply
will be discussed in a future series. to the Microsoft EKM Provider interface. The EKM
Provider interface leaves it to the key management
MIGRATING LOCALLY STORED vendor to perform the needed cryptographic functions
on the key server. These functions do not map to
KEYS TO KEY MANAGEMENT
KMIP operations and attributes. While it is advisable
Many Microsoft SQL Server users start their encryption
to deploy key management solutions that meet KMIP
projects by using the option to locally store the
standards, it is not required for SQL Server encryption.
database encryption key on the local SQL Server
instance. While this is not a security best practice, it is
a common way to start an encryption project.

Fortunately, it is easy to migrate a locally stored


encryption key to a proper key management solution.
The migration involves moving the protection of
the SQL Server database key to key management
protection and does not require the decryption of
the database. The database key which is currently
protected by local keys and certificates is placed

Page 12
EKM PROVIDER IMPLEMENTATION
Extensible key management (EKM) provider CONFIGURATION OF AN EKM
software can involve several components that
PROVIDER
include installation of the EKM Provider software,
Once the EKM Provider software is installed you must
configuration of encryption and key management
configure usage options. These options may include:
options, installation of credentials for the key server,
• The hostname or IP address of a key server
and of course the EKM Provider software itself. The
• The hostname or IP address of one or more
EKM Provider software is provided by your encryption
failover key servers
key management vendor. In some cases this software
• The name of the SQL Server instance being
may be an extra charge feature from your vendor, and
protected
in other cases there may be no charge for the EKM
• The Windows account under which the EKM
Provider. In any case, the EKM Provider software is
Provider software will operate
specific to the encryption key management solution
• The location of credentials for the key server
you are using.
• The fingerprint of the HSM certificate used to
protect the TDE key, or a password
INSTALLATION OF AN EKM • The state of application logging options
PROVIDER • License codes for the EKM Provider
The EKM Provider software that is responsible • And possibly other configuration options
for direct integration of SQL Server with your key
manager and is installed on the actual server where The configuration of the EKM Provider may be initiated
SQL Server is running. While different vendors by the installation process, or may be available from
approach the installation process in different ways, a Windows menu or command line facility. Properly
you can expect that a standard Windows MSI configuring the EKM Provider software is a necessary
installation application will be used to install the first step for activating SQL Server encryption through
software and perform initial configuration of the EKM the SQL Server management console.
Provider options. In order to support flexible system
administration of your SQL Server environment, the
installation of the EKM Provide software usually does
not immediately start the encryption process, but this
varies from one EKM Provider to another.

Page 13
EKM PROVIDER IMPLEMENTATION (CONT)

INSTALLING & PROTECTING KEY using AES encryption for TDE the performance is
generally quite good. While Triple DES (3DES) is an
SERVER CREDENTIALS
option with SQL Server TDE I would recommend
The protection of the credentials used to access
avoiding it. AES performs better and is expected to
the encryption key server is crucial to your security
have a longer life as an industry standard.
strategy. The method used to protect those
credentials is left to the EKM Provider and varies from
When you implement SQL Server Cell Level
one vendor to the next. You should carefully review
Encryption (CLE) the encryption is performed by the
this strategy to insure that credentials and certificates
EKM Provider software, and not by SQL Server. It is
are properly protected in the SQL Server context.
therefore important to understand how the vendor
Cyber attacks often attempt to compromise the
of the EKM Provider software has implemented
credentials for a key server in order to compromise
encryption and which encryption library is used.
the protected data. The compromise of key server
Options for encryption include:
credentials should be considered a compromise of
• Use of native Windows .NET encryption
protected sensitive data.
libraries
• Use of vendor encryption libraries that meet
In many cases the credentials for an encryption key
industry standards such as AES and 3DES
server are based on PKI certificates. These can be
• Use of vendor non-standard encryption
stored in the Windows Certificate Store to achieve the
libraries (not recommended)
added security and access logging provided by the
• Use of home-grown encryption libraries (not
Windows operating system. Take care to avoid storing
recommended and not compliant)
certificates, passwords or other credentials in user
directories or in areas that are commonly accessed by
While the native Microsoft .NET encryption libraries
Windows administrative accounts.
have good performance, you should attempt to
understand the performance of any non-Microsoft
ENCRYPTION SOFTWARE encryption libraries. Additionally, the use of non-
LIBRARIES standard encryption algorithms should be avoided
When you implement SQL Server Transparent Data in order to avoid non-compliance with regulatory
Encryption (TDE) the encryption of the database is frameworks.
performed by SQL Server itself. The EKM Provider
protects the symmetric encryption key used by TDE,
but encryption (usually AES) is performed by SQL
Server using Microsoft encryption libraries. When

Page 14
EKM PROVIDER IMPLEMENTATION (CONT)

CONFIGURING EKM PROVIDER failure of a network segment or a key server does not
mean the immediate interruption of the SQL Server
KEY SERVER FAILOVER
application. For example, SQL Server TDE encryption
interacts with the key server when SQL Server is first
started. If the SQL Server instance remains active a
temporary failure of a network connection will not
interrupt the normal operation of SQL Server. Likewise,
if the EKM Provider implements secure key caching
there may not be an interruption related to Cell Level
Encryption.

EKM PROVIDER AUDIT LOGGING


Access logs for SQL Server and EKM Providers
are a critical component of a security posture for
SQL Server. All components of your SQL Server
The use of an encryption key manager requires implementation should generate access and usage
careful attention to business continuity including high logs that can be sent to log collection or a SIEM server
availability failover. Again, support for high availability in real time. The EKM Provider software should log all
failover is a vendor-dependent feature, but should be activity to the encryption key server. Active monitoring
included in your EKM Provider architecture. Key server with a SIEM solution is one of the best security
failover can be triggered by a number of events: protections available. The EKM Provider software
• Network failure should support that aspect of threat detection.
• Key server hardware failure
• Distributed Denial of Service (DDos)
• Failure of a SQL Server cluster
EKM PROVIDER SOFTWARE
• And other events RESILIENCE
Lastly, EKM Provider software should be as resilient as
Because lack of access to the key server will result possible. Software should automatically recover in the
in the inability of SQL Server to process information event of a SQL Server database restart, the failure of
requests, it is critical that the EKM Provider software a connection to a key server, and other unexpected
automatically respond to network or server failures in events. Manual intervention by a Windows network
a timely fashion. Note that for some EKM Providers the administrator or database administrator should not be
necessary.

Page 15
BUSINESS CONTINUITY
When a SQL Server customer deploys Transparent • Independent Network Interfaces (NICs)
Data Encryption (TDE) or Cell Level Encryption (CLE) • Audible alarms
and protects encryption keys on an encryption key
management solution, it is important that the key To the greatest extent possible a key management
manager implement reliable business continuity hardware system should be able to protect you from
support. Key managers are a part of the critical common hardware failure issues.
infrastructure for your applications and should be
resilient in the face of common business continuity
challenges such as data center damage or destruction
KEY SUBSTITUTION OR
(fire, hurricanes, flood, earthquake, etc.), network CORRUPTION
failures, and hardware failures. Let’s review some Key management systems store encryption keys in
aspects of key management resilience. different types of data stores on non-volatile storage
which is subject to key corruption through attack
or hardware failure, or subject to key substitution
KEY MANAGEMENT HARDWARE through attack. Key management systems should use
RESILIENCE common integrity techniques such as hash-based
Key management systems come in many form message authentication code (HMAC) or similar
factors including network attached hardware security technologies to detect this type of failure. Encryption
modules (HSMs), virtual machines for VMware and keys should not be returned to a user or application
Hyper-V, cloud instances for Microsoft Azure, Amazon in the event integrity checks fail, and all integrity
Web Services (AWS), IBM SoftLayer, Google Compute check failures should be reported in audit and system
Engine, and other cloud platforms, and as multi- logs. Additionally the integrity of the key database
tenant key management solutions such as AWS Key and application should be checked when the key
Management Service (KMS) and Azure Key Vault. manager initially starts processing. Early detection and
quarantine of bad encryption keys helps prevent data
When a key manager is deployed as a hardware corruption and gives the security administrator the
solution it should implement a number of hardware ability to restore proper operation of the key manager.
resiliency features including:

• RAID protected hard drives


• Hot swappable hard drives
• Redundant power supplies

Page 16
BUSINESS CONTINUITY (CONT)

REAL-TIME KEY MIRRORING AND


ACCESS POLICY MIRRORING
Because key management systems are a part of
an organization’s critical infrastructure, they should
implement real-time mirroring of encryption keys
and access policies to one or more secondary key
servers. The real-time nature of key mirroring is
important to prevent the loss of an encryption key
after it is provisioned but before it has been copied to
a secondary system.

Real-time mirroring should also be able to recover


from temporary network outages. If keys cannot in roles between a primary and secondary key
be mirrored because the connection between the server. When a primary key server is unavailable a
primary and secondary servers is interrupted, the key secondary key server automatically steps in to serve
mirroring facility should automatically recover and various encryption key functions. In this situation
resume mirroring when the network is operational it is important that the secondary key server now
again. This reduces the chance that keys are lost due becomes the primary key server for a period of time.
to latency in mirroring. New encryption keys may be created, the status
of existing keys may change, and access policies
Many organizations deploy complex distributed may also change. A good key mirroring architecture
networks that require multiple secondary key servers. will allow for these changes to migrate back to the
While most key management installations involve just original primary key server when it becomes available.
one production and one secondary key server, good This is the central feature of Active-Active mirroring
key management mirroring should involve the ability implementations.
of a primary key server to mirror to multiple secondary
key servers.
KEY MANAGEMENT MONITORING
Because key management systems are critical
ACTIVE-ACTIVE KEY MIRRORING infrastructure it is important to deploy monitoring
Expanding on the topic of encryption key and access tools to insure a high service level. Key management
policy mirroring, it is important that key management systems should generate and transmit system log
systems fully support role-swap system recovery
operations and this involves the dynamic change

Page 17
BUSINESS CONTINUITY (CONT)

information to a monitoring solution, and the key encryption keys, server configuration, and access
management system should enable monitoring by policies.
external monitoring applications. In the event a key
server becomes unavailable it is important to identify Key management systems differ from traditional
the outage quickly. business applications in one important aspect - data
encryption keys should be backed up separately
from key encryption keys. You should be able to
KEY MANAGEMENT SYSTEM
backup data encryption keys automatically or on
LOGGING AND AUDIT demand, but you should take care to separately
Another important aspect of key management
backup and restore key encryption keys. This is a core
business continuity is proper system logging of the
requirement for key management systems.
key management server. Key management systems
are high value targets of cyber criminals and active
monitoring of key management system logs can eBook:
detect an attack early in the cycle. Encryption & Key Management
for Microsoft SQL Server
Additionally, key management systems should audit all
management and use of encryption keys and policies.
A good key management solution will audit all actions
on encryption keys from creation to deletion, all
changes to key access policies, and all access to keys
by users and applications. These audit logs should
be transmitted to a log collection or SIEM monitoring
solution in real time.

KEY MANAGEMENT BACKUP


AND RESTORE
As critical systems key managers must implement
backup and restore functions. In the event of a
catastrophic loss of key management infrastructure,
restoring to a known good state is a core requirement. DOWNLOAD
Good key management systems enable secure,
automated backup of the data encryption keys, key

Page 18
KEY MANAGEMENT BEST PRACTICES
Protecting encryption keys from loss is the most substantially raises the bar for attackers, and largely
important part of an encryption strategy and there is eliminates the threat of loss from replaced hard drives,
good documentation on security best practices for stolen virtual machine or cloud images, and lost
encryption key management. Security best practices backup images.
for key management also appear in many compliance
regulations such as the PCI-DSS and others.
SEPARATION OF DUTIES

SEPARATING ENCRYPTION KEYS


FROM THE DATA THEY PROTECT
One of the core best practices for encryption key
management is to separate the storage of encryption
keys away from the data that they protect. Using a
key management system designed for the creation
and storage of keys is central to this security best
practice. The separation of encryption keys away from
protected data makes the compromise of sensitive
data much harder. Compromising and retrieving locally
stored encryption keys is usually a simple task, and
this is true for SQL Server locally stored keys.
Separation of Duties (SOD), sometimes called
These common practices are weak security for SQL Segregation of Duties, is a core security principle
Server encryption keys: in financial, medical and defense applications. In
the context of protecting sensitive data separation
• Encryption keys stored in application programs of duties is important to minimize accidental or
• Encryption keys stored in a SQL Server table intentional loss of sensitive data by insiders. As
• Encryption keys stored in folders on a local or applied to Information Systems separation of
remote Windows server duties requires that those who create and manage
• Encryption keys stored with password encryption keys should not have access to sensitive
protection data, and those who manage databases (database
• Encryption keys stored locally by SQL Server administrators) should not have access to encryption
Transparent Data Encryption (TDE) keys.
Separating encryption keys from protected data Organizations should assign encryption key

Page 19
KEY MANAGEMENT BEST PRACTICES (CONT)

management duties to specific security administrators security administrators to authenticate minimizes the
who do not have database administration duties, threat of insider damage or theft of critical encryption
and not assign key management duties to DBAs. In key secrets.
modern key management systems this is managed by
the assignment of user-friendly names to encryption
keys. The user-friendly names for encryption keys,
SPLIT KNOWLEDGE
sometimes call key aliases, are exchanged between
the security administrator and the SQL Server DBA.
This avoids sharing the actual encryption keys.

DUAL CONTROL

Because encryption keys are critical to the security


of protected data, this security best practice requires
that no one person sees or takes possession of an
encryption key that is visible in the clear. Modern
key management systems minimize this threat
by not exporting or displaying encryption keys to
The NIST guide for Key Management Best Practices administrators or users, and not using passwords as
defines the encryption key management role as a part of the key creation process. If you use a key
critical part of the security strategy. Management management system that generates or exports keys
of encryption key systems should implement Dual based on passwords, or which exposes encryption
Control. This means that two or more security keys in the clear to administrators or users, you should
administrators should authenticate to the key server implement split knowledge controls. SQL Server
before any work is performed. Requiring a quorum of

Page 20
KEY MANAGEMENT BEST PRACTICES (CONT)

protects Transparent Data Encryption keys by never PHYSICAL SECURITY


storing them in the clear on the SQL Server instance. Physical security controls are also an important
security best practice for encryption key management
MINIMUM NUMBER OF KEY and similar security applications and devices. Physical
ADMINISTRATORS controls in the data center include keyed access
Another security best practice designed to reduce to server rooms, locked cabinets and racks, video
insider threats and the loss of administrative monitoring and other controls. While physical security
credentials is to keep the number of people who of key management hardware security modules
manage your key management system to the smallest (HSMs) is fairly easy to accomplish, it is also necessary
reasonable number. The fewer administrators who to insure physical controls for virtual environments that
have access to the key management system the use VMware or Hyper-V, and for cloud environments.
fewer opportunities for accidental or intentional loss of In cloud environments you may have to work with your
encryption keys. cloud service provider to insure proper protection of
virtualized key management server instances.

MULTI-FACTOR
AUTHENTICATION DATA ENCRYPTION KEY
Like any critical component of our information ROTATION
management system, encryption key management Periodically changing the data encryption key (DEK)
systems should implement multi-factor authentication, of your protected data is also a security best practice
sometimes called two factor authentication, to reduce and required by some compliance regulations like PCI-
the threat of the theft of administrative credentials. DSS. This is sometimes referred to as “key rotation”
Cyber criminals use a number of techniques to or “key rollover”. Your key management system may
capture important administrative credentials including help in this area by allowing the specification of the
phishing, social engineering, memory scraping, and crypto-period of the key and automatically changing
other types of attacks. Multi-factor authentication is the key for you. Of course, the retention of the older
an important security control and best practice for key is needed to insure that encrypted data can
encryption key management systems. be decrypted. Changing encryption keys and re-
encrypting sensitive data is a security best practice.

Page 21
KEY MANAGEMENT BEST PRACTICES (CONT)

KEY ENCRYPTION KEY ROTATION NETWORK SEGMENTATION


In proper key management systems the data As critical security systems it is a best practice to
encryption keys (DEK) are protected by separate key use network segmentation of key management
encryption keys (KEK). Key encryption keys are only systems and of the applications that access the key
used to protect DEK and are never used to directly management systems. Network segmentation can
protect sensitive data. Key encryption keys reside only be accomplished through normal IT infrastructure,
on the key management system and must not leave through virtualized network management as
that system except as a part of a secure backup. KEK implemented by VMware, and in cloud platforms
rotation is generally less frequent than DEK rotation, using cloud service provider network segmentation
but should be a part of your key management system. rules. Further network access controls can often be
implemented in the key management system using
ADMINISTRATOR & USER firewall rules.

AUTHENTICATION
Key management systems are designed to generate AUDIT & LOGGING
strong encryption keys and protect them from loss. Lastly, all security devices including key management
Of course, it must also enable the use of encryption systems should collect and transmit audit and system
keys to protect sensitive data. The key management logs to a log collection server or SIEM monitoring
system should implement strong authentication solution. Active monitoring of critical application and
controls for access to the key server, and further security systems is an important security control and
should implement strong authentication for the use of best practice. Key management systems should fully
specific encryption keys. This is normally implemented implement support for active monitoring.
using PKI infrastructure and mutual authentication
between clients and servers. This exceeds the typical In summary, security best practices for key
authentication that you might encounter using a web management systems used for SQL Server data
browser with a secure session. A key management protection should reflect well-understood and
system should insure that a secure session is documented best practices for security devices. The
negotiated by a known and trusted client. To ensure core source of these best practices is the National
this most key management systems incorporate a Institute for Standards and Technology’s Special
private certificate authority and do not rely on public Publication 800-57, “Recommendation for Key
certificate authorities to insure the highest level of Management.” Your key management solution for SQL
trust in the authentication. Server should implement these best practices.

Page 22
KEY MANAGEMENT STANDARDS
For many customers in highly regulates industries the Advanced Encryption Standard (AES). AES is
creating an encryption strategy means adopting now also an adopted standard within ISO and other
industry standards and the standards requirements international standards organizations. NIST published
of compliance regulations. In this part of the series the standard as Federal Information Processing
on Microsoft SQL Server encryption we will look in Standard 197, or FIPS-197.
more detail at the relevant standards for encryption,
encryption key management, and key management AES is now the predominant choice for encrypting
interfaces. data at rest, and is a part of common Internet
protocols that combine asymmetric key operations
It is important to note that there are different industry with symmetric key operations. AES is a symmetric
standards across the international landscape. We block cipher using 128-bit blocks and supporting
will primarily at the standards published by the multiple key sizes of 128, 192 and 256-bits. Most new
National Institute of Standards and Technology implementations of AES encryption use the 256-bit
(NIST) but it is important to understand that other key size for the stronger security it provides.
standards bodies work in this area including the
International Organization for Standardization (ISO) Microsoft SQL Server customers should choose the
and the American National Standards Institute (ANSI). AES encryption algorithm when encrypting SQL Server
There are some differences between the published databases with Transparent Data Encryption (TDE)
standards, but there is a great deal of interconnection or Cell Level Encryption (CLE). While other standard
and overlap. We will focus here on standards that are methods such as Triple DES are available, using AES
common across different standards bodies as many is recommended for better ongoing compliance.
organizations must meet a variety of international
standards.
STANDARDS FOR ENCRYPTION
KEY MANAGERS
STANDARDS FOR ENCRYPTION NIST classifies encryption
In 2001 the National institute key management systems
for Standards and Technology a “Cryptographic Modules”
worked with an international and applies the Federal
group of cryptographers and Information Processing Standard 140-2 (FIPS 140-2,
security experts to evaluate encryption algorithms “Security Requirements for Cryptographic Modules”) to
and to eventually adopt the Rijndael algorithm as them. In addition to promulgating this standard, NIST

Page 23
KEY MANAGEMENT STANDARDS (CONT)

also provides a certification and validation program The KMIP standard defines the interface to a key
via the National Voluntary Laboratory Accreditation management solution for creating encryption keys,
Program (NVLAP). This means that encryption key assigning various attributes and status values to
management systems can be formally certified that keys, performing encryption key retrieval, executing
they meet the FIPS 140-2 standard. All professional encryption services, and a variety of other operations
key management systems have been validated that are common to encryption key management
through the NVLAP program and Microsoft SQL Server systems. The KMIP standard does not specify
customers should look for this level of compliance. operational functions of a KMIP key server such as
network configuration, firewall rules, system logging
While encryption key management systems can and other server functions.
be validated to the FIPS 140-2 standard it does not
automatically follow that a software vendor with a The Microsoft SQL Server Extensible Key Management
SQL Server TDE solution also uses a validated key (EKM) interface specification pre-dates the OASIS
server. Always be sure to check with the NIST web KMIP standard and does not implement that standard.
site to insure a key management vendor’s FIPS 140-2 The interface to the key management system is left to
compliance. the particular key management vendor to implement.
However, KMIP remains important to the SQL Server
customer as other database and application services
STANDARDS FOR SECURE KEY may need to use key management services.
MANAGEMENT INTERFACES
While the NIST FIPS 140-2
validation of a key server STANDARDS FOR SECURE KEY
indicates compliance MANAGEMENT CONNECTIONS
with an important Client-side applications that need to connect to a key
industry cryptographic standard, it does not specify server have traditionally used one of two methods:
how client applications actually communicate and
interoperate with a key server. The Key Management • Vendor-supplied software libraries
Interoperability Protocol (KMIP) provides this interface • A secure Transport Layer Security (TLS)
standard. The KMIP protocol is promulgated through connection
the OASIS standards group in the KMIP Technical
Committee. Prior to the promotion of the OASIS KMIP standard it
was common for encryption key management vendors
to implement software libraries that performed the

Page 24
KEY MANAGEMENT STANDARDS (CONT)

functions of securely connecting to a key server SQL SERVER STANDARDS


and retrieving keys or performing key management
SUMMARY
functions. This required that the customer install
Microsoft SQL Server customers are well-advised
vendor-supplied software on each client-side system,
to use standard encryption methods and key
configure the software, install updates on a periodic
management systems that meet industry standards.
basis, and manage the software environment. This
This includes the use of standard AES encryption for
could be a labor-intensive process.
TDE or CLE encryption, and the use of an encryption
key management solution that meets FIPS 140-2 and
The OASIS KMIP protocol defines a secure TLS
KMIP compliance. Implementing encryption and key
interface to the key manager that does not require
management based on industry standards ensures
vendor-supplied software libraries. Instead the client-
compliance with common industry regulations.
side system uses the Internet standard TLS protocol
to create the secure connection. This is sometimes
referred to as an “agentless” connection. Almost all “Microsoft SQL Server
professional key management systems now support
the KMIP protocol and use an agent-less, secure TLS
customers should choose
session for the connection. the AES encryption algorithm
Microsoft SQL Server customers that deploy when encrypting SQL Server
Transparent Data Encryption (TDE) or Cell Level databases with Transparent
Encryption (CLE) depend on software libraries
provided by the key management vendor. The SQL Data Encryption (TDE) or Cell
Server interface pre-dates the KMIP specification.
Level Encryption (CLE). While
Note that the vendor-supplied solution may still use a
secure TLS interface to the key manager in their own other standard methods such
solution.
as Triple DES are available,
using AES is recommended
for better ongoing
compliance.”

Page 25
PLATFORM SUPPORT
Microsoft SQL Server customers often un applications ON-PREMISE VMWARE
in complex environments that span the on-premise
INFRASTRUCTURE
data center, hosting platforms, VMware data centers,
For good reasons most SQL Server customers have
cloud SQL Server database as a service, and full
moved to virtualize the data center using VMware
Infrastructure-as-a-Service cloud platforms. Hybrid
technologies. The administrative and cost benefits
combinations of these platforms are more the rule
of virtualizing Windows and Linux workloads are
than the exception and this adds complexity to the
compelling and most of us are taking advantage of
IT strategy. When we look at SQL Server encryption
VMware technologies. For SQL Server customers
it is important to understand where database server
deploying encryption in the VMware infrastructure can
support is located, and where encryption key
present some challenges.
management servers are located.

The first challenge is ensuring vendor support for SQL


TRADITIONAL IT GLASS HOUSE Server encryption running in a VMware virtualized
While there has been a dramatic move to virtualize Windows server. Not all vendors of SQL Server
data centers with VMware and other virtualization Transparent Data Encryption and Cell Level Encryption
technologies, the traditional customer data center still solutions support the VMware environment, nor all
houses a large number of SQL Server applications. common versions of VMware.
Some of these applications process sensitive data that
the Enterprise does not want to expose to the Internet, The second major challenge is how to deploy
or core intellectual property that must remain inside encryption key management in VMware infrastructure.
the data center to meet governance requirements, or Some vendor key management solutions only
applications that have not yet moved to virtualized or support deployment as hardware security modules
cloud platforms. Whatever the reason for housing SQL (HSMs), and this architecture is exactly what VMware
Server applications in the data center, the SQL Server customers are trying to avoid. An optimal key
encryption strategy should support that environment. management solution for SQL Server in VMware
In many ways this is the easiest environment in environments would also be virtualized and be
which to deploy SQL Server encryption and key installable in an appropriate VMware security
management. Almost all vendors of encryption key group. Securing encryption key management
management solutions for SQL Server support a systems in VMware has different and more stringent
traditional data center deployment. requirements that securing SQL Server applications.
Fortunately VMware has provided good guidance
on the steps you should take to secure true VMware
instances of key managers.

Page 26
PLATFORM SUPPORT (CONT)

HOSTED VMWARE challenge related to encryption and key management.


In most cases a migration from on-premise VMware
INFRASTRUCTURE
infrastructure to cloud will involve many changes to
Several hosting providers and cloud service
the methods with which applications are deployed,
providers have implemented support for full VMware
configured, managed, and secured. And new
deployments. Rackspace and IBM SoftLayer are the
challenges arise around SQL Server encryption and
first that come to mind, but there are many other
key management.
service providers in this area. These service providers
offer the full VMware application stack as a part of
For SQL Server encryption the first challenge has
the deployment and this can be an attractive way for
to do with the deployment of an EKM Provider to
a SQL Server customer running on-premise VMware
integrate with the key management system. Some
infrastructure to move the cloud. In most cases the
cloud platforms provide a minimal implementation of
same VMware infrastructure that runs on-premise can
an EKM Provider to their own shared key management
be replicated in this hosted environment. This means
infrastructure. Some provide no native cloud support
that SQL Server encryption and key management
for EKM Providers. SQL Server customers typically
solutions can also easily move.
turn to key management vendors for the EKM Provider
support needed to integrate SQL Server encryption
VMware also implements an architecture called
with a key management system. Care should be
vCloud. This is a special implementation of VMware
taken to insure that the key management vendor
infrastructure in a hosted environment. The range of
fully supports the cloud platform and the method of
services that surround a vCloud implementation varies
deployment.
from one hosting provider to another. In some cases
the vCloud implementation only supports the simple
Encryption key management for SQL Server presents
case of running a VMware virtual machine. In other
even larger challenges for the Enterprise customer.
cases the full range of VMware management facilities
Cloud platforms may not provide flexible choices
are available. SQL Server customers must carefully
for encryption key management, and the issue of
evaluate vCloud implementations to insure that they
key custody (does the cloud service provider have
will support the necessary SQL Server encryption and
access to your encryption keys) can be very difficult. In
key management solutions.
almost all cases a key management service provided
by a cloud platform is accessible either logically or
CLOUD (AWS, AZURE, ETC.) physically by cloud service provider employees. Great
Migrating or implementing SQL Server applications
care should be taken to ensure that your selection
in pure cloud platforms represents a significant
of a key management solution in the cloud meets

Page 27
PLATFORM SUPPORT (CONT)

your compliance, governance and risk management want to ensure that you key management vendor can
strategies. easily integrate across these disparate platforms.

Ideally you will have a complete range of choices on SUMMARY


where to deploy the SQL Server key management Rapidly evolving cloud and virtualization platforms
solution. Being able to deploy a fully cloud-based present on-going challenges to the SQL Server
key management solution that is dedicated to you, customer. VMware infrastructure remains important
or choosing to deploy a key management solution and organizations of all sizes are looking to
outside of the cloud as a VMware instance or leverage the benefits of the cloud. It is likely that
hardware security module should be reasonable hybrid deployments of applications across all of the
choices available to you. You may start with a cloud- above platforms will remain the rule rather than the
based key management solution and then decide to exception. SQL Server customers should take care
migrate to on-premise key management. This should when selecting and deploying an encryption and key
be a well-supported strategy by your cloud service management solution that they do not hinder cloud
provider and your key management vendor. and virtualization efforts.

HYBRID For good reasons most SQL Server customers have


As mentioned above the Enterprise SQL Server moved to virtualize the data center using VMware
customer generally has a mix of on-premise and technologies.
hosted or cloud applications. These applications often
need to integrate data exchange. While SQL Server
encryption is relatively easy to implement on any of
the above platforms, a seamless integration of key
management across platforms can be a challenge.
Traditional hardware security modules often have
different interfaces than more modern virtual or cloud
key managers. When this is the case the automation
of key and key access policy sharing can be very
difficult to accomplish. In addition, business continuity
functions such as backup/restore and failover may
in some cases be impossible to accomplish. You will

Page 28
VENDOR CONSIDERATIONS
Generally, the considerations for sourcing encryption upgrading the key manager to new versions, and
and key management solutions for SQL Server will be problem determination. All of these aspects should be
similar to any relationship you develop with a vendor. covered in vendor documentation.
The limited number of vendors in this space can limit
the choices you have, but there are good solutions to TRAINING
choose from. While key management solutions have become much
simpler over time, you should still expect to receive
some operational and technical training from your
LICENSING
Vendors take a variety of approaches to licensing their encryption and key management vendor. Gone are
EKM Provider software and their key management the days when this meant a lot of on-site educational
solution. The main difference is in licensing constraints expense. Modern encryption and key management
on the SQL Server side. You may start your first solutions may require only a few hours of coaching
SQL Server encryption project with a rather limited and training to deploy and maintain. Be sure your
scope. But as you continue to encrypt more sensitive encryption and key management vendor has a
data you may need to scale up the number of SQL program to deliver training in a timely fashion.
Server client-side license. Some encryption vendors
license software based on the number of SQL Server CUSTOMER SUPPORT
instances that you place under protection. Others Many businesses have devalued the customer
provide unlimited numbers of client –side licenses support experience and this can present a problem
after you acquire the key manager. Be sure you for SQL Server users. When you have a problem with
understand the licensing terms of each solution you encryption or key management, it is likely to affect
evaluate, and be sure to understand your long term your application service levels. Before acquiring your
needs. SQL Server encryption solution be sure to schedule
time with the customer support group. Do they have a
formal problem tracking system? Do you have access
DOCUMENTATION to all problem tickets you raise? Does the customer
Documentation on your SQL Server implementation
support group respond in a timely fashion? Is there
will be crucial for long term success. In addition to
a 24/7 response number? All of the normal customer
documentation on the installation and configuration,
support questions you might ask are relevant to a SQL
be sure that your vendor provides documentation on
Server encryption solution. We all know what really
key rotation, applying patches to the key manager,
bad customer support looks like, be sure there is a
good team standing behind the solution you deploy.

Page 29
VENDOR CONSIDERATIONS (CONT)

SERVICES
The modern Enterprise is often geographically
distributed and this can make deployment and MORE INFORMATION
training difficult. While SQL Server encryption and key
management solutions can be simple to deploy and
configure, you may want to be sure that you vendor WEBINAR:
can send staff on site for this type of support. ENCRYPTION &
KEY MANAGEMENT WITH
MICROSOFT SQL SERVER
“Vendors take a variety
of approaches to licensing
their EKM Provider
software and their key
management solution.
The main difference is in
licensing constraints on the
SQL Server side.”
VIEW WEBINAR

Page 30
ALLIANCE KEY MANAGER

“A very cost effective solution


in terms of performance,
manageability, security, and 30-DAY EVALUATION
availability.  As a result, my company
was quickly able to implement full
database encryption leveraging
the AKM as our key management
solution in weeks.  Comparable
ALLIANCE
solutions could have taken months.” KEY MANAGER
- CERTAIN

TOWNSEND SECURITY IS HELPING MICROSOFT


SQL Server customers with Alliance Key Manager. The
solution includes the Key Connection for SQL Server • FIPS 140-2 and KMIP compliant
application to help Microsoft users implement Trans- enterprise key manager
parent Data Encryption (TDE) and Cell Level Encryp- • Available as an HSM, VMware, or in
tion (column level encryption) without the need for the cloud (AWS, Microsoft Azure)
application development. This application installs as
• Affordably priced, with no restritions
a service on SQL Server and provides the Extensible
on server connections or
Key Management (EKM) provider software. With inte- client side applications
grated support for multiple, redundant AKM key serv-
• Meet compliance regulations like
ers Microsoft customers can deploy encryption rapidly
PCI DSS, HIPAA, FFIEC, and more
and without programming.

Alliance Key Manager is FIPS 140-2 compliant and


in use by over 3,000 organizations worldwide. The
solution is available as a hardware security module
(HSM), VMware instance, and in the cloud (Amazon
REQUEST EVALUATION
Web Services, Microsoft Azure, and VMware vCloud).
Townsend Security offers a 30-day, fully-functional
evaluation of Alliance Key Manager.

Page 31
ABOUT TOWNSEND SECURITY

“Townsend is a full service security


provider that remains on the cutting
edge and has demonstrated
exceptional customer service.”
- CSU FRESNO

TOWNSEND SECURITY CREATES DATA PRIVACY


solutions that help organizations meet evolving
compliance requirements and mitigate the risk of data
breaches and cyber-attacks. Over 3,000 organizations
worldwide trust Townsend Security’s NIST and FIPS
140-2 compliant solutions to meet the encryption
and key management requirements in PCI DSS,
HIPAA/HITECH, FISMA, GLBA/FFIEC, SOX, and other
regulatory compliance requirements.

CONTACT TOWNSEND SECURITY


www.townsendsecurity.com
@townsendsecure

105 8th Avenue SE, Suite 301


Olympia, WA 98501

360.359.4400

Page 32

You might also like