The Encryption Primer Steve Jones Editor SQLServerCentral.

Slides:



Advertisements
Similar presentations
Spring 2000CS 4611 Security Outline Encryption Algorithms Authentication Protocols Message Integrity Protocols Key Distribution Firewalls.
Advertisements

An Introduction to Secure Sockets Layer (SSL). Overview Types of encryption SSL History Design Goals Protocol Problems Competing Technologies.
Module 5: TLS and SSL 1. Overview Transport Layer Security Overview Secure Socket Layer Overview SSL Termination SSL in the Hosted Environment Load Balanced.
Cryptography and Authentication Lab ECE4112 Group4 Joel Davis Scott Allen Quinn.
Environmental Council of States Network Authentication and Authorization Services The Shared Security Component February 28, 2005.
DESIGNING A PUBLIC KEY INFRASTRUCTURE
70-293: MCSE Guide to Planning a Microsoft Windows Server 2003 Network, Enhanced Chapter 9: Planning and Managing Certificate Services.
ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Cryptographic Security.
Cryptography Basic (cont)
Chapter 5 Cryptography Protecting principals communication in systems.
ECOMMERCE TECHNOLOGY FALL 2003 COPYRIGHT © 2003 MICHAEL I. SHAMOS Cryptography.
Gavin Payne Transparent Data Encryption The Hows, Whys and Whens.
Cryptographic Technologies
70-270, MCSE/MCSA Guide to Installing and Managing Microsoft Windows XP Professional and Windows Server 2003 Chapter Nine Managing File System Access.
Chapter 13: Electronic Commerce and Information Security Invitation to Computer Science, C++ Version, Fourth Edition SP09: Contains security section (13.4)
An Encryption Primer Steve Jones Editor in Chief SQLServerCentral.
TrustPort Public Key Infrastructure. Keep It Secure Table of contents  Security of electronic communications  Using asymmetric cryptography.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
AGENDA Tools used in SQL Server 2000 Graphical BOL Enterprise Manager Service Manager CLI Query Analyzer OSQL BCP.
How to Take Advantage of Contained Databases in SQL Server 2012 Steve Jones SQLServerCentral Red Gate Software.
Chapter 8.  Cryptography is the science of keeping information secure in terms of confidentiality and integrity.  Cryptography is also referred to as.
Digital Signature Xiaoyan Guo/ Xiaohang Luo/
What is in Presentation What is IPsec Why is IPsec Important IPsec Protocols IPsec Architecture How to Implement IPsec in linux.
CSCI 6962: Server-side Design and Programming
.Net Security and Performance -has security slowed down the application By Krishnan Ganesh Madras.
SYSTEM ADMINISTRATION Chapter 13 Security Protocols.
Jim McLeod MyDBA  SQL Server Performance Tuning Consultant with MyDBA  Microsoft Certified Trainer with SQLskills Australia 
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Linux Networking and Security Chapter 8 Making Data Secure.
Roy Ernest Database Administrator Pinnacle Sports Worldwide SQL Server 2008 Transparent Data Encryption.
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
E-Commerce Security Technologies : Theft of credit card numbers Denial of service attacks (System not availability ) Consumer privacy (Confidentiality.
Security David Frommer Principal Architect Business Intelligence Microsoft Partner of the Year 2005 & 2007.
Cryptography, Authentication and Digital Signatures
Day 18. Concepts Plaintext: the original message Ciphertext: the transformed message Encryption: transformation of plaintext into ciphertext Decryption:
Certificate-Based Operations. Module Objectives By the end of this module participants will be able to: Define how cryptography is used to secure information.
Types of Electronic Infection
1 Securing Data and Communication. 2 Module - Securing Data and Communication ♦ Overview Data and communication over public networks like Internet can.
April 10, Platinum and Gold Partners Data Encryption and Key Management in SQL Said Salomon Database Administrator Unitrin Direct Insurance.
Internet-security.ppt-1 ( ) 2000 © Maximilian Riegel Maximilian Riegel Kommunikationsnetz Franken e.V. Internet Security Putting together the.
11-Basic Cryptography Dr. John P. Abraham Professor UTPA.
CS 4244: Internet Programming Security 1.0. Introduction Client identification and cookies Basic Authentication Digest Authentication Secure HTTP.
TCP/IP Protocol Suite 1 Chapter 30 Security Credit: most slides from Forouzan, TCP/IP protocol suit.
1 Thuy, Le Huu | Pentalog VN Web Services Security.
1 Objectives Discuss File Services in Windows Server 2008 Install the Distributed File System in Windows Server 2008 Discuss and create shared file resources.
C Copyright © 2007, Oracle. All rights reserved. Security New Features.
IP Security (IPSec) Matt Hermanson. What is IPSec? It is an extension to the Internet Protocol (IP) suite that creates an encrypted and secure conversation.
March 7, 2013 SQL Encryption and You By Todd Kleinhans
Building Defense in Depth using the Full Spectrum of SQL Server Encryption.
Over 18 yrs experience with SQL Server
Secure SQL Database with TDE Thomas Chan SQL Saturday Raleigh.
End to End Always Encrypted in SQL Server 2016 Steve Jones SQLServerCentral Redgate Software.
CloudBerry Explorer for S3. CB Explorer Free to use Browse and manage files PowerShell functions Open and edit files  CloudBerry Explorer is an easy.
1 Example security systems n Kerberos n Secure shell.
SQL Server Encryption Ben Miller Blog:
CRYPTOGRAPHY Cryptography is art or science of transforming intelligible message to unintelligible and again transforming that message back to the original.
Chapter 5 : Designing Windows Server-Level Security Processes
Mike Furgal Director – DB and Pro2 Services March 20th, 2017
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Designing Database Solutions for SQL Server
IS3230 Access Security Unit 9 PKI and Encryption
Transparent Data Encryption (TDE)
Encryption Not just for the NSA anymore
End to End Security and Encryption in SQL Server
Secure/Encrypt SQL Server Database With TDE
Building Defense in Depth using the Full Spectrum of SQL Server Encryption Michael Keleher Database Administrator Hays Consultant at PwC.
Presentation transcript:

The Encryption Primer Steve Jones Editor SQLServerCentral

Agenda  Goals  Who Am I?  What is Encryption?  Encryption in SQL Server  Communications  Transparent Data Encryption  Hashing  Keys  Symmetric Keys  Asymmetric Keys

Goals Learn about the encryption options Understand TDE setup and use Gain the basics of encrypting data with keys

Get in touch Steve Jones /in/way0utwest

Agenda What is encryption? Encryption in SQL Server Communications Transparent Data Encryption Hashing Keys Symmetric Keys Asymmetric Keys

What is Encryption?

encryption is the process of transforming information (referred to as plaintext) using an algorithm (called a cipher) to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key. The result of the process is encrypted information (in cryptography, referred to as ciphertext). informationplaintext algorithmcipherkey ciphertext - Wikipedia

Simple Ciphers ABCDEFGHIJKLMNOPQRSTUVWXYZ DEFGHIJKLMNOPQRSTUVWXYZABC WKLV LV HQFUBSWHG

Simple Ciphers ABCDEFGHIJKLMNOPQRSTUVWXYZ DEFGHIJKLMNOPQRSTUVWXYZABC WKLV LV HQFUBSWHG THIS IS ENCRYPTED

Complex Encryption Results: x00E2A26D824E DE6F450DA DE09EF 3AD8D7C989E393BF9FE1368D04C1B9BEE086EFFDF6F77AF9 E3A3B8142F23723D536C72C216D6F9B104A5E44A

Agenda What is encryption? Encryption in SQL Server Communications Transparent Data Encryption Hashing Keys Symmetric Keys Asymmetric Keys

Encryption in SQL Server Client SQL Server Instance Client file system Communication Link (the wire) SQL Server memory SQL Server data files Backup files

Encryption in SQL Server Client SQL Server Instance Client file system Communication Link (the wire) SQL Server memory SQL Server data files Backup files

Encryption in SQL Server Client SQL Server Instance Client file system Communication Link (the wire) SQL Server memory SQL Server data files Backup files

Encryption in SQL Server Client SQL Server Instance Client file system Communication Link (the wire) SQL Server memory SQL Server data files Backup files

Encryption in SQL Server Client SQL Server Instance Client file system Communication Link (the wire) SQL Server memory SQL Server data files Backup files

Encryption in SQL Server Client SQL Server Instance Client file system Communication Link (the wire) SQL Server memory SQL Server data files Backup files

Encryption in SQL Server Client SQL Server Instance Client file system Communication Link (the wire) SQL Server memory SQL Server data files Backup files

Encryption Hierarchy

Agenda What is encryption? Encryption in SQL Server Communications Transparent Data Encryption Hashing Keys Symmetric Keys Asymmetric Keys

Communications Encrypt the connection to/from SQL Server – Encrypt “the wire” Two options – SSL encryption from SQL Server – IPSec encryption at the Windows host network layer.

SSL Communications  Certificate must be valid based on the system time  DO NOT USE SELF SIGNED CERTIFICATES  All rules in BOL  Encrypting Connections to SQL Server Encrypting Connections to SQL Server  How to: Enable Encrypted Connections to the Database Engine How to: Enable Encrypted Connections to the Database Engine

Agenda What is encryption? Encryption in SQL Server Communications Transparent Data Encryption Hashing Keys Symmetric Keys Asymmetric Keys

Transparent Data Encryption  TDE introduced in SQL Server 2008  Protects the data at rest by encrypting the data on disk.  IFI not supported  The transaction log is encrypted  Backups are encrypted (can eliminate compression)  Tempdb is encrypted for all operations.  Replication data is not encrypted  Filestream data is not encrypted

Transparent Data Encryption  Implemented with a simple ALTER DATABASE command  Encryption is handled by the Database Encryption Key (DEK)  Requires a Database Master Key (DMK) and a Certificate to protect the DEK  Backups of the certificate protecting the DEK are necessary to restore a backup.

Transparent Data Encryption Demo

Transparent Data Encryption  Overhead is < 5%  Enterprise Edition only (not BI edition)  Value?  Third Party Tools

Agenda What is encryption? Encryption in SQL Server Communications Transparent Data Encryption Hashing Keys Symmetric Keys Asymmetric Keys

Hashing  “A hash function is any algorithm or subroutine that maps large data sets, called keys, to smaller data sets.” - Wikipediaalgorithm subroutinedata sets

Hashing  SQL Server uses the HASHBYTES functions  CHECKSUM() or BINARY_CHECKSUM() can also be used, but not for encryption.  Other implementations using.NET/CLR are better. (see Expert SQL Server Encryption, Michael Coles)

Hashing  DEMO

Hashing or Encryption  Hashing is not really encryption  Decryption is not supported (usually)  Hashing is deterministic, encryption is not  Hashing is quicker  Hashed values can be indexed  Choose the strongest algorithm available in your version.  SQL Server 2008/2005 – SHA1  SQL Server 2012/ SHA2_512

Agenda What is encryption? Encryption in SQL Server Communications Transparent Data Encryption Hashing Keys Symmetric Keys Asymmetric Keys

Keys  Multiple Keys in SQL Server  Service Master Key  Database Master Key  Database Encryption Key  Symmetric Keys  Asymmetric Keys  Certificates

The Encryption Hierarchy

Service Master Key  Service Master Key = SMK  No CREATE DDL  Secured by Windows DPAPI (default)  Must be manually backed up. BACKUP SERVICE MASTER KEY  Must be restored in a DR situation to open other keys secured by this key (Database Master Keys)  Encryption is with AES

Database Master Key  Database Master Key = DMK  The DMK is created by an administrator (CREATE/ALTER DDL) in each database  Secured by the SMK and a password (TripleDES encryption in 2008, AES in 2012)  This can be secured by password only (DROP ENCRYPTION BY SERVICE MASTER KEY option)

Database Master Key  Backup and restore using DDL commands BACKUP MASTER KEY RESTORE MASTER KEY  OPEN/CLOSE manually if not protected by the SMK

Agenda What is encryption? Encryption in SQL Server Communications Transparent Data Encryption Hashing Keys Symmetric Keys Asymmetric Keys

Symmetric Encryption  Like a normal key lock  The key that encrypts the data also decrypts the data

Symmetric Keys  Symmetric Keys are created in a database and are always in that database (cannot be backed up/restored)  Symmetric Keys are deterministic, and can be duplicated with the same creation parameters.  Symmetric keys require less resources than asymmetric keys, but there is still an additional CPU load from their use.

Symmetric Keys  The identity value always generates the same GUID for the key. These must be unique in a session.  The KEY_SOURCE and IDENTITY can be used to recreate a key. If you choose the same values, and the same algorithm, you’ll get the same key  You can, and should, secure these keys with asymmetric keys

Symmetric Keys  DEMO

Symmetric Keys  The algorithm used is stored in the header of the encrypted data.  You can generate temporary keys for encryption/decryption  CREATE SYMMETRIC KEY #MyTempKey  Encryption with passphrases uses symmetric keys (TripleDES)

Agenda What is encryption? Encryption in SQL Server Communications Transparent Data Encryption Hashing Keys Symmetric Keys Asymmetric Keys

Asymmetric Encryption  Asymmetric keys are unlike keys and locks in the real world.  Based on factoring very large prime numbers.  More secure than symmetric keys  Require more resources for encryption/decryption than symmetric keys

Asymmetric Encryption Now is the time for all good men to come to the aid of their country Asymmetric Algorithm Key 1 0x26CD66B61E50369 CBBDB42F E02238EEAE588E06D 00F8D0C6FAB5C48F6 8639ABB CFB 48A41BA373CFA411E 99D3AB31A1B7CE40 CB35 Asymmetric Algorithm Key 1 0xE7A518047A8D383 6B76006D9CE04DA2F A57CD7F9EE8 55FC3451EB02A076F 28DD614BA841AC75 6E52CFEC C8204D579083C4AD0 D627CAD24

Asymmetric Encryption Now is the time for all good men to come to the aid of their country Asymmetric Algorithm Key 1 0x26CD66B61E50369 CBBDB42F E02238EEAE588E06D 00F8D0C6FAB5C48F6 8639ABB CFB 48A41BA373CFA411E 99D3AB31A1B7CE40 CB35 Asymmetric Algorithm Key 2 Now is the time for all good men to come to the aid of their country

Asymmetric Encryption Key 1 – Private Key Key 2 – Public Key Keys 1 and 2 are paired and generated together. One is referred to as a private key and the other a public key. Only the user has the private key, but the public key is distributed to everyone

Asymmetric Encryption Now is the time for all good men to come to the aid of their country Asymmetric Algorithm Anyone encrypts with Steve’s Public Key 0x26CD66B61E50369 CBBDB42F E02238EEAE588E06D 00F8D0C6FAB5C48F6 8639ABB CFB 48A41BA373CFA411E 99D3AB31A1B7CE40 CB35 Asymmetric Algorithm Only Steve can decrypt with his private key Now is the time for all good men to come to the aid of their country

Asymmetric Encryption Now is the time for all good men to come to the aid of their country Asymmetric Algorithm Steve can encrypt with his private key 0x26CD66B61E50369 CBBDB42F E02238EEAE588E06D 00F8D0C6FAB5C48F6 8639ABB CFB 48A41BA373CFA411E 99D3AB31A1B7CE40 CB35 Asymmetric Algorithm Anyone can decrypt with Steve’s public key Now is the time for all good men to come to the aid of their country

Asymmetric Encryption Now is the time Steve can encrypt with his private key 0x26CD66B61E50369 CBBDB42F Steve encrypts again with Andy’s Public Key 0x48385D8A87BD329F F328E476BC234 0x26CD66B61E50369 CBBDB42F

Asymmetric Encryption 0x48385D8A87 BD329FF328E4 76BC234 Andy decrypts the outer message with his private key 0x26CD66B61E50369 CBBDB42F Andy then decrypts with Steve’s Public key to verify the message is from Steve Now is the time 0x26CD66B61E50369 CBBDB42F

Asymmetric Encryption  Use DDL to create asymmetric keys (CREATE/DROP/ALTER)  Can be created outside the server (FROM FILE option)  SN.exe (Visual Studio SDK)  Makecert (Windows SDK)

Asymmetric Encryption  You can encrypt an asymmetric key with a password.  This will be required for decryption  Not required for encryption  Asymmetric keys are usually used to encrypt symmetric keys, which encrypt the data. This balances security with resources  You can remove the private key (prevents decryption in that db).

Certificates  Certificates are asymmetric keys with additional metadata.  Expiration dates are not enforced by SQL Server  Administrators must decrypt/re-encrypt the data and remove the old certificates  Useful for marking the key rotation dates (query sys.certificates)  To restore certificates, use CREATE CERTIFICATE.  SQL Server 2012 increases the maximum certificate length to 4,096.  Always use the longest length you can.

Asymmetric Encryption  Demo

Key Length  Use long keys  DKIM attack on Google’s mail system*  384 bit key cracked on high end laptop  512 bit key cracked for ~$75 using AWS  768 bit key could be cracked by large orgs  This changes all the time * 58

Goals Learn about the encryption options Understand TDE setup and use Gain the basics of encrypting data with keys

The End  Questions?  Don’t forget to fill out your evaluations  Resources at the end of the PPT  

References  Encryption -  Understanding TDE -  Hash Function - Hash Function -  Rainbow Tables -  Transparent Data Encryption – data-encryption/ data-encryption/  How to enable/remove Transparent Data Encryption (TDE) - encryption-tde.aspx encryption-tde.aspx  Sys.database_encryption_keys -  TDE and Backup Compression - backup-compression-part-2.aspxhttp://sqlcat.com/sqlcat/b/technicalnotes/archive/2009/02/16/tuning- backup-compression-part-2.aspx  Encrypting Connections to SQL Server -

References  HASHBYTES - us/library/ms aspxhttp://msdn.microsoft.com/en- us/library/ms aspx  CHECKSUM() - us/library/ms aspxhttp://msdn.microsoft.com/en- us/library/ms aspx  BINARY_CHECKSUM() - us/library/ms aspx  Expert SQL Server Encryption - ag=redgatsof- 20&linkCode=as2&camp=1789&creative=9325&am p;creativeASIN=  Data Hashing in SQL Server - hashing.aspx hashing.aspx

References  CREATE ASYMMETRIC KEY - us/library/ms aspx  ALTER ASYMMETRIC KEY - us/library/ms aspxhttp://technet.microsoft.com/en- us/library/ms aspx  CREATE CERTIFICATE -  ALTER CERTIFICATE -  BACKUP CERTIFICATE -  sys.certificates -  ENCRYPTBYPASSPHRASE - us/library/ms aspx  ENCRYPTBYKEY -  ENCRYPTBYASYMKEY -

References  ENCRYPTBYCERT -  DECRYPTBYKEY -  DECRYPTBYASYMKEY -  DECRYPTBYCERT -  DECRYPTBYKEYAUTOASYMKEY - us/library/ms aspxhttp://technet.microsoft.com/en- us/library/ms aspx  DECRYPTBYKEYAUTOCERT - us/library/ms aspxhttp://technet.microsoft.com/en- us/library/ms aspx

References Windows SDK (Makecert) - us/windowsserver/bb aspxhttp://msdn.microsoft.com/en- us/windowsserver/bb aspx SN.EXE - Subway Hacked - gave-subway-a-30-million-lesson-in-point-of-sale-security.arshttp://arstechnica.com/business/news/2011/12/how-hackers- gave-subway-a-30-million-lesson-in-point-of-sale-security.ars Install SSL Certificate - ssl-connection-on-sql-server-2005-clustered-installation.aspx ssl-connection-on-sql-server-2005-clustered-installation.aspx Encrypting Connections to SQL Server - us/library/ms aspxhttp://msdn.microsoft.com/en- us/library/ms aspx SQL Server 2005: A look at the master keys - part Cryptography in SQL Server us/library/cc837966%28v=sql.100%29.aspxhttp://msdn.microsoft.com/en- us/library/cc837966%28v=sql.100%29.aspx

Images  Enigma Machine -  The Encryption Hierarchy from BOL - US/library/ms189586%28v=SQL.90%29.aspxhttp://msdn.microsoft.com/en- US/library/ms189586%28v=SQL.90%29.aspx  Hashing Image - _1_1_0_0_1_0_LL.svg/240px-Hash_table_4_1_1_0_0_1_0_LL.svg.png _1_1_0_0_1_0_LL.svg/240px-Hash_table_4_1_1_0_0_1_0_LL.svg.png  TDE Structure -