Du har forskellige muligheder her.
-
Du kan bruge symmetrisk kryptering til dine data:
OPRET TABELsalg (...)
Opret symmetrisk nøgle:
CREATE CERTIFICATE cert_sales WITH SUBJECT = N'Sales certificate',
START_DATE = N'2009-01-01', EXPIRY_DATE = N'2018-12-31';
CREATE SYMMETRIC KEY symkey_sales WITH ALGORITHM = AES_256
ENCRYPTION BY CERTIFICATE cert_sales
Krypter data:
TRUNCATE TABLE sales;
OPEN SYMMETRIC KEY symkey_sales DECRYPTION BY CERTIFICATE cert_sales;
INSERT INTO sales() SELECT a, ENCRYPTBYKEY(Key_Guid(N'symkey_sales'), B) FROM T2;
CLOSE SYMMETRIC KEY symkey_sales;
Dekrypter data:
OPEN SYMMETRIC KEY symkey_sales DECRYPTION BY CERTIFICATE cert_sales;
SELECT a, CAST(DecryptByKey(B) as nvarchar(100)) FROM sales;
CLOSE SYMMETRIC KEY symkey_sales;
- Du kan bruge asymmetrisk kryptering til dine data
- Du kan bruge gennemsigtig datakryptering for kryptering af alle databasefiler:
Opret hovednøgle:
USE master
go
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'My$Strong$Password$123'
Opret certifikat:
CREATE CERTIFICATE DEK_EncCert WITH SUBJECT = 'DEK Encryption Certificate'
Opret DEK:
USE MySecretDB
go
CREATE DATABASE ENCRYPTION KEY WITH ALGORITHM = AES_256
ENCRYPTION BY SERVER CERTIFICATE DEK_EncCert
Slå kryptering til:
ALTER DATABASE MySecretDB SET ENCRYPTION ON
- Du kan bruge BitLocker - komplet volumenkryptering