USE master;
GO

CREATE MASTER KEY ENCRYPTION 
   BY PASSWORD = 'Vive la Covid-19 !';
GO

BACKUP MASTER KEY TO FILE = 'H:\DATABASE_SQL\BACKUPS\SQL2019FBIN2\MK.bkp'
ENCRYPTION BY PASSWORD = 'Vive la Covid-19 !'

CREATE CERTIFICATE CRT_FOR_TDE
   WITH SUBJECT = 'Certificat pour le chiffrement TDE',
   EXPIRY_DATE = '2022-01-01' ;
GO

USE [DB_GRAND_HOTEL];
GO

CREATE DATABASE ENCRYPTION KEY
WITH ALGORITHM = AES_128
ENCRYPTION BY SERVER CERTIFICATE CRT_FOR_TDE;
GO

ALTER DATABASE [DB_GRAND_HOTEL]
SET ENCRYPTION ON;
GO

