E N D
SQL SERVER ENKRIPSI KRIPTOGRAFI • Kriptografi (cryptography) berasaldaribahasaYunani”cryptos” artinya ”secret” (rahasia), sedangkan ”graphein” artinya ”writing” (tulisan). Jadikriptografiberarti ”secret writing” (tulisanrahasia). Kriptografiadalahilmudanseniuntukmenjagakeamananpesan (Bruce Schneier, 1996). Dalamkriptografiterdapatprosesenkripsidandekripsi Inayatullah
SQL SERVER ENKRIPSI Enkripsiyaitusuatuprosespengamansuatu data yang disembunyikanatauproseskonversi data ( plaintext ) menjadibentuk yang tidakdapatdibaca/ dimengerti. Dekripsiyaitukebalikandariprosesenkripsiyaituproseskonversi data yang sudahdienkripsi ( ciphertext ) kembalimenjadi data aslinya ( Original Plaintext ) sehinggadapatdibaca/ dimengertikembali. Inayatullah
SQL SERVER ENKRIPSI KomponendariKriptografi Plain text Sumberberita/pesan/teksasli Cipher text Teks yang sudahdiproses (diacak, digantikan) Algoritma & kunci Misal: subsitusi (algoritma) & number of shift (kunci) Pemisahanalg & kunciditemukanolehAugusteKerckhoffs von Niewenhof (1883) Inayatullah
SQL SERVER ENKRIPSI Contoh: Inayatullah
SQL SERVER ENKRIPSI Memiliki Algoritma Contoh: Inayatullah
SQL SERVER ENKRIPSI PENGGUNAAN ENKRIPSI Mengamankan data denganmengacak data sehinggasulituntukdibaca(confidentiality) Meyakinkantidakadaperubahan data(Integrity) Memastikanidentitasseseorangdengan digital Signature(Authentication) Inayatullah
SQL SERVER ENKRIPSI H I R A R K I Inayatullah
Encryption SQL SERVER ENKRIPSI Alice SYMMETRIC KEY = > KUNCI ENKRIPSI DAN DEKRIPSI SAMA Bob Shared (secret) key Decryption Plaintext Plaintext Ciphertext My phone555-1234 My phone555-1234 Y$3*@ Eve Inayatullah
Encryption SQL SERVER ENKRIPSI Public key repositoryCertificate Authority (CA) Public key Private key ASYMMETRIC KEY = > KUNCI ENKRIPSI DAN DEKRIPSI BERBEDA Decryption Plaintext Plaintext Ciphertext My phone555-1234 My phone555-1234 L)8*@Hg Inayatullah
SQL SERVER ENKRIPSI ANSI X9.17 HirarkiEnkripsi Inayatullah
SQL SERVER ENKRIPSI • HOW TO : BACK UP THE SERVICE MASTER KEY • HOW TO : RESTORE THE SERVICE MASTER KEY • HOW TO : ALTER THE SERVICE MASTER KEY • HOW TO : CREATE A DATABASE MASTER KEY • HOW TO : BACK UP A DATABASE MASTER KEY • HOW TO : RESTORE A DATABASE MASTER KEY • HOW TO : ALTER A DATABASE MASTER KEY Inayatullah
SQL SERVER ENKRIPSI 1. BackUp Service Master Key Contoh: BACKUP SERVICE MASTER KEY TO FILE = N'C:\MyServiceMasterKey.key’ ENCRYPTION BY PASSWORD = N'$45^ZeF&u'; GO Inayatullah
SQL SERVER ENKRIPSI 2. RESTORE (mengembalikan) SERVICE MASTER KEY Contoh: RESTORE SERVICE MASTER KEY FROM FILE = N'C:\MyServiceMasterKey.key' DECRYPTION BY PASSWORD = '$45^ZeF&u'; GO Inayatullah
SQL SERVER ENKRIPSI 3. ALTER ( UNTUK MEMODIFIKASI ) SERVICE MASTER KEY Contoh: ALTER SERVICE MASTER KEY WITH NEW_ACCOUNT = 'SQL2008Server\Michael', NEW_PASSWORD = '^&3h4l1xPr'; GO Inayatullah
SQL SERVER ENKRIPSI 4. CREATE DATABASE MASTER KEY Contoh: CREATE MASTER KEY ENCRYPTION BY PASSWORD = '123'; GO Inayatullah
SQL SERVER ENKRIPSI 5. BACKUP MASTER KEY Contoh: BACKUP MASTER KEY TO FILE = N'C:\MyDatabaseMasterKey.key' ENCRYPTION BY PASSWORD = N'123'; GO Inayatullah
SQL SERVER ENKRIPSI 6. RESTORE MASTER KEY Contoh: RESTORE MASTER KEY FROM FILE = 'C:\MyDatabaseMasterKey.key' DECRYPTION BY PASSWORD = '123' ENCRYPTION BY PASSWORD = '456'; GO Inayatullah
SQL SERVER ENKRIPSI 7. ALTER MASTER KEY Contoh: -- Add encryption by password ALTER MASTER KEY ADD ENCRYPTION BY PASSWORD = '789'; GO -- Remove encryption by password ALTER MASTER KEY DROP ENCRYPTION BY PASSWORD = '789'; GO Inayatullah
SQL SERVER ENKRIPSI Catalog Views 1. Sys.Asymmetric_keys SELECT name, asymmetric_key_id, pvt_key_encryption_type_desc, thumbprint, algorithm_desc, key_length, public_key FROM sys.asymmetric_keys;
SQL SERVER ENKRIPSI 2. SYS.CERTIFICATES SELECT name, certificate_id, pvt_key_encryption_type_desc, subject, cert_serial_number, start_date, expiry_date, thumbprint FROM sys.certificates;
SQL SERVER ENKRIPSI 3. SYS.CRYPTOGRAPHIC_PROVIDERS SELECT provider_id, name, guid, version, dll_path, is_enabled FROM sys.cryptographic_providers;
SQL SERVER ENKRIPSI BUAT DATA YANG DI ENKRIPSI /* 1. Membuat Database */ USE master GO CREATE DATABASE EncryptTest ON PRIMARY ( NAME = N'EncryptTest', FILENAME = N'C:\EncryptTest.mdf') LOG ON ( NAME = N'EncryptTest_log', FILENAME = N'C:\EncryptTest_log.ldf') GO Inayatullah
SQL SERVER ENKRIPSI /* 2. Membuattabeldanisi data ketabel */ USE EncryptTest GO CREATE TABLE TestTable (FirstCol INT, SecondCol VARCHAR(50)) GO INSERT INTO TestTable (FirstCol, SecondCol) SELECT 1,'First' UNION ALL SELECT 2,'Second' UNION ALL SELECT 3,'Third' UNION ALL SELECT 4,'Fourth' UNION ALL SELECT 5,'Fifth' GO Inayatullah
SQL SERVER ENKRIPSI /* 3. Cektabeldanisinya */ USE EncryptTest GO SELECT * FROM TestTable GO Inayatullah
SQL SERVER ENKRIPSI DATA YANG SUDAH DI BUAT Inayatullah
SQL SERVER ENKRIPSI /* 4. Membuat Database Master Key */ USE EncryptTest GO CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'SQLAuthority' GO Inayatullah
SQL SERVER ENKRIPSI /* 5. MembuatSertifikat */ USE EncryptTest GO CREATE CERTIFICATE EncryptTestCert WITH SUBJECT = 'SQLAuthority' GO Inayatullah
SQL SERVER ENKRIPSI /* 6. MembuatKunciSimetrik */ USE EncryptTest GO CREATE SYMMETRIC KEY TestTableKey WITH ALGORITHM = TRIPLE_DES ENCRYPTION BY CERTIFICATE EncryptTestCert GO Inayatullah
SQL SERVER ENKRIPSI /* 7. Enkripsi Data */ USE EncryptTest GO ALTER TABLE TestTable ADD EncryptSecondCol VARBINARY(256) GO Inayatullah
SQL SERVER ENKRIPSI /* 8. Mengupdatekolom */ USE EncryptTest GO OPEN SYMMETRIC KEY TestTableKey DECRYPTION BY CERTIFICATE EncryptTestCert UPDATE TestTable SET EncryptSecondCol = ENCRYPTBYKEY(KEY_GUID('TestTableKey'),SecondCol) GO Inayatullah
SQL SERVER ENKRIPSI /* 9. DROP original column which was encrypted for protect the data */ USE EncryptTest GO ALTER TABLE TestTable DROP COLUMN SecondCol GO Inayatullah
SQL SERVER ENKRIPSI /* 10. Mengecek Data yang sudahdiEnkripsi */ USE EncryptTest GO SELECT * FROM TestTable GO Inayatullah
SQL SERVER ENKRIPSI DATA YANG SUDAH DI ENKRIPSI
SQL SERVER ENKRIPSI /* 11. MelakukanDekripsi Data */ USE EncryptTest GO OPEN SYMMETRIC KEY TestTableKey DECRYPTION BY CERTIFICATE EncryptTestCert SELECT CONVERT(VARCHAR(50),DECRYPTBYKEY(EncryptSecondCol)) AS DecryptSecondCol FROM TestTable GO Inayatullah
SQL SERVER ENKRIPSI DATA YANG SUDAH DI DEKRIPSI
SQL SERVER ENKRIPSI TERIMA KASIH Inayatullah